【发布时间】:2011-10-18 14:08:58
【问题描述】:
我尝试通过 UIPopoverController 中的 UIWebView 打开 wiki 移动版网页。问题是,无论我如何设置 contentSizeForViewInPopover,或者只是 UIWebView 框架,或者只是设置 UIWebView.scalesPageToFit = YES。 Wiki 移动版页面内容大小似乎比我的 UIWebView 大。但是如果我在 iPhone 上使用它,就没有这样的问题。这是我的弹出框控制器代码:
//create a UIWebView UIViewController first
WikiViewController *addView = [[WikiViewController alloc] init];
addView.contentSizeForViewInPopover = CGSizeMake(320.0, 480.0f);
//then create my UIPopoverController
popover = [[UIPopoverController alloc] initWithContentViewController:addView];
popover.delegate = self;
[addView release];
//then get the popover rect
CGPoint pointforPop = [self.mapView convertCoordinate:selectAnnotationCord
toPointToView:self.mapView];
CGRect askRect = CGRectMake((int)pointforPop.x, (int)pointforPop.y+10, 1.0, 1.0);
[popover presentPopoverFromRect:askRect
inView:self.mapView
permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
[self.mapView deselectAnnotation:annotation animated:YES];
这是我创建 UIWebView 的代码:
- (void)viewDidLoad
{
wikiWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
wikiWebView.scalesPageToFit = YES;
//or No, doesn't matter, it all get larger than this
wikiWebView.delegate = self;
self.view = wikiWebView;
}
所有代码似乎都很典型... 不知道有没有人可以给我一些启发,非常感谢。
【问题讨论】:
标签: uiwebview