iOS development, the system comes with the sharing simple implementation

Source: Internet
Author: User

  • Because there is no Sina Weibo option in the simulator settings, so choose the real machine debugging, success. Not much code, including header files
  • No login information is configured, it is not useful.
  • Specific code implementation
    1- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event2 {3     //1. Determine if the platform is available4     if(![Slcomposeviewcontroller Isavailableforservicetype:slservicetypesinaweibo]) {5NSLog (@"The platform is not available, or no associated account is configured");6         return;7     }8     9     //2. Create a shared controllerTenSlcomposeviewcontroller *COMPOSEVC =[Slcomposeviewcontroller Composeviewcontrollerforservicetype:slservicetypesinaweibo]; One      A     //2.1. Add the shared text -[Composevc Setinitialtext:@"I'm a Codeman ."]; -      the     //2.2. Add a picture -[Composevc addimage:[uiimage imagenamed:@"xingxing"]]; -      -     //2.3. Add a shared link +[Composevc addurl:[nsurl urlwithstring:@"www.baidu.com"]]; -      +     //3. Pop-up sharing controller A [self PRESENTVIEWCONTROLLER:COMPOSEVC animated:yes completion:nil]; at      -     //4. Listen to the user clicked Cancel or send -Composevc.completionhandler = ^(slcomposeviewcontrollerresult result) { -         if(Result = =slcomposeviewcontrollerresultcancelled) { -NSLog (@"Click the Cancel"); -}Else { inNSLog (@"Click the Send"); -         } to     }; +}

iOS development, the system comes with the sharing simple implementation

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.