質問

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