Question

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!!

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top