我正在为iPhone制作文章阅读应用。
在viewDidLoad
我为共享表添加了导航栏按钮。
当我点击分享按钮时,分享页面会打开google mail按钮和facebook按钮。现在我想点击共享表中的facebook按钮调用我自己的功能。
这是代码:
- (IBAction)ysshareAction:(id)sender {
//share sheet defination
NSURL *Imageurl = [NSURL URLWithString:_DetailModal1[2]];
NSData *data = [NSData dataWithContentsOfURL:Imageurl];
UIImage *image = [[UIImage alloc] initWithData:data];
NSURL *linkURL = [NSURL URLWithString:_DetailModal1[4]];//article url
NSMutableAttributedString *stringText = [[NSMutableAttributedString alloc] initWithString:_DetailModal1[0]];//_DetailModal1[0] contain article title////
[stringText addAttribute:NSLinkAttributeName value:linkURL range:NSMakeRange(0, stringText.length)];
//If(click on fb button) //Isuue is here
// { do following }
NSArray *itemArrany = @[stringText,image,];//title is displayed but not as hyperlink.
UIActivityViewController *AVC = [[UIActivityViewController alloc] initWithActivityItems:itemArrany applicationActivities:nil];
AVC.excludedActivityTypes=@[];
[self presentViewController:AVC animated:YES completion:nil];
}