我是ios开发的新手,我有一个主viewController包含导航项,而我点击导航项popover viewcontroller看起来很好并且gettig准确的contentSize对于Popover中的View(320,845),问题是当我点击popover viewcontroller popover中的按钮Contentsize有被改变。
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];
最佳答案
试试这个....
- (void)viewWillAppear:(BOOL)animated
{
CGSize size = CGSizeMake(320, 845); // size of view in popover
self.contentSizeForViewInPopover = size;
[super viewWillAppear:animated];
}