我嘗試通過UIPopoverController內的UIWebView來打開維基手機版本的網頁。問題是,無論我如何設置我的contentSizeForViewInPopover,或只是UIWebView框架,或簡單地設置UIWebView.scalesPageToFit = YES。 Wiki移動版本頁面的內容大小似乎比我的UIWebView大。但是如果我在iPhone上使用它,就沒有這樣的問題。這裏是我的酥料餅的控制器代碼:在UIPopoverController中的UIWebView中顯示維基移動頁面
//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;
}
所有代碼似乎是典型的... 我想知道如果任何人都可以擺脫我一些光,非常感謝。