Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top