iOS 分享到微信之后返回应用关闭发送成功的提示,并自定义提示,具体内容如下
1.关闭发送成功的提示
只要在分享的时候调用一下代码即可:
复制代码 代码如下: [UMSocialConfig setFinishToastIsHidden:YES position:UMSocialiToastPositionCenter];
2.自定义提示
//如果点击返回app会调用这个方法
- (void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response {
//返回200说明分享成功
if (response.responseCode == 200) {
//分享成功之后弹出这个提示语
//自己添加遮罩层,并添加点击手势,方便回收提示
self.mask2 = [[UIView alloc] initWithframe:CGRectMake(0, 0, kScreen_Width, kScreen_Height)];
self.mask2.backgroundColor = [[UIColor colorWithHexColorString:@"000000"] colorWithAlphaComponent:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
[self.mask2 addGestureRecognizer:tap];
[self.view.window addSubview:self.mask2];
//遮罩层上放提示框
self.showView = [[UIView alloc] init];
self.showView.frame = CGRectMake(32, kScreen_Height/2.0-((kScreen_Width-64)/254.0*150.0+44)/2.0-20, kScreen_Width-64, 0);
self.showView.backgroundColor = [UIColor whiteColor];
self.showView.layer.cornerRadius = 20;
[self.mask2 addSubview:_showView];
UILabel *titleLab = [[UILabel alloc] initWithframe:CGRectMake(0, 0, _showView.width, 31)];
titleLab.text = @"分享成功";
titleLab.textAlignment = NSTextAlignmentCenter;
titleLab.backgroundColor = [UIColor redColor];
titleLab.textColor = [UIColor whiteColor];
titleLab.font = [UIFont systemFontOfSize:15];
//使用贝塞尔曲线,绘制一个上面两个是圆角的矩形
UIBezierPath *titlePath = [UIBezierPath bezierPathWithRoundedRect:titleLab.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(20, 20)];
CAShapeLayer *titleLayer = [CAShapeLayer layer];
titleLayer.frame = titleLab.bounds;
titleLayer.path = titlePath.CGPath;
titleLab.layer.mask = titleLayer;
[_showView addSubview:titleLab];
UILabel *lab = [[UILabel alloc] initWithframe:CGRectMake(16, 31+16, _showView.width-32, 15)];
lab.textAlignment = NSTextAlignmentLeft;
lab.text = @"大家都在看";
lab.textColor = [UIColor colorWithHexColorString:@"000000"];
lab.font = [UIFont systemFontOfSize:15];
[_showView addSubview:lab];
NSMutableArray *arr = [[NSMutableArray alloc] initWithObjects:@"",@"" nil];
int y = 31+16+15+16;
for (int i = 0; i
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



