国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS微信分享后關閉發送成功提示并返回應用

2020-07-26 03:14:24
字體:
來源:轉載
供稿:網友

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<arr.count; i++) {         UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];         CGSize size = [self getStringSize:arr[i] andFont:13 andWidth:self.showView.width-32];         button1.tag = 600+i;         button1.frame = CGRectMake(16, y, _showView.width-32, size.height);         [button1 setTitle:arr[i] forState:UIControlStateNormal];         button1.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;         [button1 setTitleColor:[UIColor colorWithHexColorString:@"0096ff"] forState:UIControlStateNormal];         button1.titleLabel.font = [UIFont systemFontOfSize:13];         [button1 addTarget:self action:@selector(button1Click:) forControlEvents:UIControlEventTouchUpInside];         button1.titleLabel.numberOfLines = 0;         [_showView addSubview:button1];         y+=size.height+16;         if (i+1!=arr.count) {           UIView *line = [[UIView alloc] initWithFrame:CGRectMake(16, y, self.showView.width-32, 0.5)];           line.backgroundColor = [UIColor colorWithHexColorString:@"f0f0f0"];           [_showView addSubview:line];           y+=0.5+16;         }                }       self.showView.frame = CGRectMake(32, kScreen_Height/2.0-((kScreen_Width-64)/254.0*150.0+44)/2.0-20, kScreen_Width-64, y+16);     } failure:^(AFHTTPRequestOperation *operation, NSError *error) {     }];   }else{     [MBProgressHUD showError:@"分享失敗"];   } }   //獲取字符串的長度 -(CGSize)getStringSize:(NSString*)needString andFont:(CGFloat)font andWidth:(NSInteger)width {   CGSize size = CGSizeZero;   size = [needString boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:font]} context:nil].size;   return size; } //若點擊在某個區域之內不觸發,否則觸發 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {   if ([touch.view isDescendantOfView:self.showView]) {     return NO;   }else {     return YES     ;   } } - (void)tap:(UITapGestureRecognizer *)sender {   [self.mask2 removeFromSuperview]; } - (void)button1Click:(UIButton *)sender {   [self.mask2 removeFromSuperview];   switch (sender.tag) {     case 600:     {     }       break;     case 601:     {     }       break;     default:       break;   } }

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安龙县| 资源县| 达尔| 定安县| 旬邑县| 漳州市| 芦山县| 万州区| 修文县| 涡阳县| 扬州市| 河间市| 宁陵县| 盘山县| 北碚区| 漯河市| 平阳县| 渑池县| 平舆县| 古浪县| 格尔木市| 四会市| 新巴尔虎右旗| 江山市| 晋城| 永靖县| 南澳县| 青海省| 南漳县| 贵阳市| 马尔康县| 伊宁县| 徐闻县| 白银市| 清水县| 电白县| 太湖县| 石门县| 嘉祥县| 彩票| 台州市|