gpt4 book ai didi

iOS Webview 分享应用

转载 作者:行者123 更新时间:2023-11-29 11:45:28 30 4
gpt4 key购买 nike

我有一个没有 Storyboard的 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];

最佳答案

如果你特别想要用户点击的链接的url,那么用这种方式找到它

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
//CAPTURE USER LINK-CLICK.
NSLog(@"navigationType = %@",navigationType);

return YES;
}

关于iOS Webview 分享应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44150885/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com