使IPad的UIPopoverController等于屏幕大小

时间:2012-04-04 10:43:31

标签: iphone ipad uipopovercontroller

我想使两个方向的UIPopoverController大小等于IPad屏幕的大小。怎么做?

2 个答案:

答案 0 :(得分:0)

CGRect popoverRect = [self.view convertRect:[btn frame] 
                                   fromView:[btn superview]];

popoverRect.size.width = self.view.frame.size.width; 
popoverRect.origin.x  = popoverRect.origin.x+150; 
popoverRect.size.height = self.view.frame.size.width;
[self.popoverController 
 presentPopoverFromRect:popoverRect 
 inView:self.view 
 permittedArrowDirections:UIPopoverArrowDirectionLeft
 animated:YES];

答案 1 :(得分:0)

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.contentSizeForViewInPopover = CGSizeMake(width,height);}

这是在视图中设置的,您必须在弹出控制器中设置