I am trying to resize a popover UIView. The following is the code I'm using to make the clip:

-(void)viewWillLayoutSubviews
{
 [super viewWillLayoutSubviews];
 CGRect box;
 box = self.view.frame;
 box.size.height -= 100;
 [self.view setFrame:box];
}

This gives me the following result:

enter image description here

The self.view background is white. What do I need to do in order to clip the portion marked as 'X'. The UIView, self.view is the topmost view of the UIViewController.

Any help is appreciated!!

有帮助吗?

解决方案

In the controller for the view, you can define preferredContentSize. Like this

self.preferredContentSize = CGSizeMake(width, height);

*Ninja edit: Pre-iOS7, you would use self.contentSizeForViewInPopover

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top