我是ios developpement的新手。我有一个主视图控制器有导航项目,而我点击导航项目popover viewcontroller看起来很好和gettig确切contentSize For View In Popover(320,845),问题是当我点击按钮内的popover viewcontroller popover必须更改内容。
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];
答案 0 :(得分:6)
试试这个......
- (void)viewWillAppear:(BOOL)animated
{
CGSize size = CGSizeMake(320, 845); // size of view in popover
self.contentSizeForViewInPopover = size;
[super viewWillAppear:animated];
}
答案 1 :(得分:6)
这不适合iOS 7。
popoverController.popoverContentSize = CGSizeMake(320, 845);
是您正在寻找的。 p>