How to embed Facebook share on iOS like at attached pic -
i came across app love know did used sharing on facebook.
the app shows share button opens window (see below image). share parameters of share dialog image , url meaning when post wall ever tap on go entered url.
does know how it?
you can native slcomposeviewcontroller
. add social media framework. import in project add following lines:
- (ibaction)facebookpost:(id)sender { if ([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) { slcomposeviewcontroller *myslcomposersheet = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook]; [myslcomposersheet setinitialtext:@"social framework sharing test!"]; [myslcomposersheet addimage:[uiimage imagenamed:@"myimage.png"]]; [myslcomposersheet addurl:[nsurl urlwithstring:@"http://stackoverflow.com/questions/32692493/how-to-embed-facebook-share-on-ios-like-at-attached-pic"]]; [myslcomposersheet setcompletionhandler:^(slcomposeviewcontrollerresult result) { switch (result) { case slcomposeviewcontrollerresultcancelled: nslog(@"post canceled"); break; case slcomposeviewcontrollerresultdone: nslog(@"post sucessful"); break; default: break; } }]; [self presentviewcontroller:myslcomposersheet animated:yes completion:nil]; } }
Comments
Post a Comment