3

我是 ios 开发的新手。我有一个主 viewController 有导航项,而我点击导航项弹出视图控制器看起来很好并且 gettig 确切 contentSize For View In Popover(320,845),问题是当我点击弹出视图控制器内的按钮时弹出内容大小有被改变。

UIBarButtonItem *btn = (UIBarButtonItem *)sender;
Agamam *agamamView = [[Agamam alloc] initWithNibName:@"Agamam" bundle:nil];
agamamView.delegate=self;
agamamView.contentSizeForViewInPopover  =CGSizeMake(agamamView.view.frame.size.width, agamamView.view.frame.size.height); 

UINavigationController *navController =  [[UINavigationController alloc] initWithRootViewController:agamamView];
popAgamamView = [[UIPopoverController alloc] initWithContentViewController:navController];
[popAgamamView presentPopoverFromBarButtonItem:btn permittedArrowDirections:YES animated:YES];
4

2 回答 2

6

这不适用于 iOS 7。

popoverController.popoverContentSize = CGSizeMake(320, 845);

就是你要找的。

于 2014-01-30T09:57:50.640 回答
6

尝试这个....

- (void)viewWillAppear:(BOOL)animated
{
   CGSize size = CGSizeMake(320, 845); // size of view in popover
   self.contentSizeForViewInPopover = size;
   [super viewWillAppear:animated];
}
于 2013-06-18T14:05:19.630 回答