![](/img/trans.png)
[英]<Image> view the old picture even after capturing a new picture using react-native-vision-camera
[英]UIwebview picture to new view controller
我有一個UIWebview顯示我的html頁面與圖片鏈接。 如何在用戶點擊鏈接時實現這一點,它會顯示一個顯示html圖像的新視圖控制器,並可以選擇返回上一屏幕?
如果您確定您的Web視圖僅包含圖像鏈接,那么您可以使當前視圖控制器實現UIWebViewDelegate,尤其是:
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
// Here you initialized your new view controller from your storyboard and pass the image url to it, and it shall know how to load it in an image view or anything, and you return NO, to stop the web view from loading the request so that the user only sees your links
SecondViewController* second = [self.storyboard instantiateViewControllerWithIdentifier:@"secondController"];
second.urlRequest = request;
[self.navigationController pushViewController:second animated:YES];
return NO;
}
當然上面的代碼假設很多東西:
您在SecondViewController類中有一個名為urlRequest的屬性。
您有一個包含FirstViewController的導航控制器。
您正在使用故事板,您的SecondViewController ID是secondController
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.