After sharing the message to WeChat on iOS, the system returns the message indicating that the application has been disabled and sent successfully.

Source: Internet
Author: User

After sharing the message to iOS, the system returns the message indicating that the application has been disabled and sent successfully.

1. Disable message sending success

You just need to call the code during the sharing:

[UMSocialConfig setFinishToastIsHidden: YES position: UMSocialiToastPositionCenter];

2. Custom prompt

// If you click return, the app will call this method.

-(Void) didFinishGetUMSocialDataInViewController :( UMSocialResponseEntity *) response {

// If 200 is returned, the sharing is successful.

If (response. responseCode = 200 ){

// This prompt is displayed after the sharing is successful.

 

// Add a mask layer by yourself and add click gestures to facilitate recycling

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];

 

// Put a prompt box on the Mask Layer

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 = @ "shared successfully ";

TitleLab. textAlignment = NSTextAlignmentCenter;

TitleLab. backgroundColor = [UIColor redColor];

TitleLab. textColor = [UIColor whiteColor];

TitleLab. font = [UIFont systemFontOfSize: 15];

// Use the besell curve to draw a rectangle with the rounded corners above

UIBezierPath * titlePath = [UIBezierPath paths: 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 = @ "Everyone is watching ";

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: @ "sharing failed"];

}

}

 

// Obtain 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 you click within a region, it is not triggered. Otherwise, it is triggered.

-(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;

}

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.