我有一個現有的應用程序,當前有嵌入的幫助文件;我正在嘗試更改它們,以便他們訪問互聯網以獲得本地化的幫助文件。這是我的代碼:爲什麼此代碼不顯示Google.com
// make the popover
UIViewController* popoverContent = [UIViewController new];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 450, 500)];
popoverView.backgroundColor = [UIColor colorWithWhite:(CGFloat)1.0 alpha:(CGFloat)1.0]; // frame color?
popoverContent.view = popoverView;
//resize the popover view shown in the current view to the view's size
popoverContent.preferredContentSize = CGSizeMake(450, 500);
NSURL *indexURL = [NSURL URLWithString:@"google.com"];
// add the UIWebView for RichText
webView = [[UIWebView alloc] initWithFrame:popoverView.frame];
webView.backgroundColor = [UIColor whiteColor]; // change background color here
// add the webView to the popover
[webView loadRequest:[NSURLRequest requestWithURL:indexURL]]; // load it...
[popoverView addSubview:webView];
// if previous popoverController is still visible... dismiss it
if ([popoverController isPopoverVisible]) {
[popoverController dismissPopoverAnimated:YES];
}
//create a popover controller to display the HELP text
popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
[popoverController presentPopoverFromRect:((UIButton *)boHelpGeneralSetup).frame inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
此代碼在嵌入幫助文件時起作用;爲什麼當我嘗試從互聯網上的網頁獲取文件時,它不工作?
當該文件嵌入? – lluisgh
包含網頁上* exact *語言的HTML文件。這與問題無關。 – SpokaneDude
嘗試使用http:// –