After sharing to WeChat on iOS, return to the prompt that the application is closed and sent successfully, and customize the prompt. The specific content is as follows
1. Close the prompt for successful sending
Just call the code when sharing:
Copy the codeThe code is as follows:
[UMSocialConfig setFinishToastIsHidden:YES position:UMSocialiToastPositionCenter];
2. Custom prompts
//If you click to return to the app, this method will be called - (void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response { //Return to 200 and share successfully if ( == 200) { //This prompt pops up after successful sharing //Add a mask layer yourself and add a click gesture to facilitate recycling prompts self.mask2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kScreen_Height)]; self. = [[UIColor colorWithHexColorString:@"000000"] colorWithAlphaComponent:0.5]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; [self.mask2 addGestureRecognizer:tap]; [ addSubview:self.mask2]; //Put the prompt box on the mask layer = [[UIView alloc] init]; = CGRectMake(32, kScreen_Height/2.0-((kScreen_Width-64)/254.0*150.0+44)/2.0-20, kScreen_Width-64, 0); = [UIColor whiteColor]; = 20; [self.mask2 addSubview:_showView]; UILabel *titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, _showView.width, 31)]; = @"Sharing Success"; = NSTextAlignmentCenter; = [UIColor redColor]; = [UIColor whiteColor]; = [UIFont systemFontOfSize:15]; //Use the Bezier curve to draw a rectangle with two rounded corners above UIBezierPath *titlePath = [UIBezierPath bezierPathWithRoundedRect: byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(20, 20)]; CAShapeLayer *titleLayer = [CAShapeLayer layer]; = ; = ; = titleLayer; [_showView addSubview:titleLab]; UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake(16, 31+16, _showView.width-32, 15)]; = NSTextAlignmentLeft; = @"Everyone is watching"; = [UIColor colorWithHexColorString:@"000000"]; = [UIFont systemFontOfSize:15]; [_showView addSubview:lab]; NSMutableArray *arr = [[NSMutableArray alloc] initWithObjects:@"",@"" nil]; int y = 31+16+15+16; for (int i = 0; i<; i++) { UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom]; CGSize size = [self getStringSize:arr[i] andFont:13 andWidth:-32]; = 600+i; = CGRectMake(16, y, _showView.width-32, ); [button1 setTitle:arr[i] forState:UIControlStateNormal]; = UIControlContentHorizontalAlignmentLeft; [button1 setTitleColor:[UIColor colorWithHexColorString:@"0096ff"] forState:UIControlStateNormal]; = [UIFont systemFontOfSize:13]; [button1 addTarget:self action:@selector(button1Click:) forControlEvents:UIControlEventTouchUpInside]; = 0; [_showView addSubview:button1]; y+=+16; if (i+1!=) { UIView *line = [[UIView alloc] initWithFrame:CGRectMake(16, y, -32, 0.5)]; = [UIColor colorWithHexColorString:@"f0f0f0"]; [_showView addSubview:line]; y+=0.5+16; } } = 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:@"Sharing failed"]; } } //Get the length of the string-(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; } //If the click does not trigger within a certain area, otherwise it will trigger- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { if ([ isDescendantOfView:]) { return NO; }else { return YES ; } } - (void)tap:(UITapGestureRecognizer *)sender { [self.mask2 removeFromSuperview]; } - (void)button1Click:(UIButton *)sender { [self.mask2 removeFromSuperview]; switch () { case 600: { } break; case 601: { } break; default: break; } }
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.