我有一个没有故事板编写的iOS Webview应用程序如何在Webview按钮上嵌入共享功能点击
网站中的HTML代码:共享应用程序
我想这样做:
NSString *textToShare = @"Look at this awesome website for aspiring iOS Developers!";
NSURL *myWebsite = [NSURL URLWithString:@"http://www.codingexplorer.com/"];
NSArray *objectsToShare = @[textToShare, myWebsite];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
NSArray *excludeActivities = @[UIActivityTypeAirDrop,
UIActivityTypePrint,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo];
activityVC.excludedActivityTypes = excludeActivities;
[self presentViewController:activityVC animated:YES completion:nil];
答案 0 :(得分:1)
如果您特别希望用户点击链接的网址,则以这种方式查找
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
//CAPTURE USER LINK-CLICK.
NSLog(@"navigationType = %@",navigationType);
return YES;
}