IOS micro-letter after sharing shutdown send success prompt and return to application _ios

Source: Internet
Author: User

IOS shares to the micro-mail after the return application to turn off send a successful prompt, and customize the prompts, specific content as follows

1. Close the prompt to send success

Just call the code when you share it:

Copy Code code as follows:
[Umsocialconfig Setfinishtoastishidden:yes Position:umsocialitoastpositioncenter];

2. Custom Hints

If you click Back to the app, this method-(void) Didfinishgetumsocialdatainviewcontroller: (umsocialresponseentity *) Response {// Return 200 description Sharing success if (Response.responsecode = 200) {//Share success after pop-up this prompt/Add mask layer and add click Gesture to facilitate recycling tips self.ma 
      Sk2 = [[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]; 
      The mask layer is placed on the cue box Self.showview = [[UIView alloc] init]; Self.showView.frame = CGRectMake (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 = @ "Share Success"; 
      Titlelab.textalignment = Nstextalignmentcenter; 
      Titlelab.backgroundcolor = [Uicolor Redcolor]; 
      Titlelab.textcolor = [Uicolor Whitecolor]; 
     Titlelab.font = [Uifont systemfontofsize:15]; Using Bezier curves, draw a rectangle above two rounded corners uibezierpath *titlepath = [Uibezierpath bezierPathWithRoundedRect:titleLab.bounds Byroundi Ngcorners: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 (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 (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 (y, self.showview.width-32, 0.) 
          5)]; 
          Line.backgroundcolor = [Uicolor colorwithhexcolorstring:@ "f0f0f0"]; 
          [_showview Addsubview:line];
 
        y+=0.5+16; } self.showView.frame = CGRectMake (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:@ "Share Failure"]; 
  }//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 is not triggered within an area, otherwise trigger-(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: {} break; 
    Case 601: {} break; 
  Default:break;
 }
 
}

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.