我在Safari中使用openURL:
方法打開網頁,但是如果該頁面已在Safari中打開,並且我打電話給openURL:
,則iOS會顯示已打開的頁面。使用openURL刷新Safari頁面:?
它應刷新或應在新標籤中打開。可能嗎?
我在Safari中使用openURL:
方法打開網頁,但是如果該頁面已在Safari中打開,並且我打電話給openURL:
,則iOS會顯示已打開的頁面。使用openURL刷新Safari頁面:?
它應刷新或應在新標籤中打開。可能嗎?
您可以在打開網頁後重新加載網頁。
使用重載網頁視圖的方法重新加載網頁
重載() - 被用來重新加載當前網頁。
我不認爲有辦法做到這一點。
如果可以的話,一個可能的簡單解決方案是實施SFSafariViewController
並在應用程序中打開您的URL。 在這個階段,你可以像UIWebView一樣控制它。
再加上你有更好的用戶體驗!
- (void)openLink:(NSString *)url
{
NSURL *URL = [NSURL URLWithString:url]];
if (URL) {
if ([SFSafariViewController class] != nil) {
SFSafariViewController *sfvc = [[SFSafariViewController alloc] initWithURL:URL];
sfvc.delegate = self;
[self presentViewController:sfvc animated:YES completion:nil];
}
else {
if (![[UIApplication sharedApplication] openURL:url]) {
NSLog(@"%@%@",@"Failed to open url:",[url description]);
}
}
}
else
{
// will have a nice alert displaying soon.
}
}
我沒有使用任何webView。 (UIApplication.sharedApplication()。openURL(NSURL(string:「https:eworkplaceapps.com」)!) )我使用openUrl方法。 –