UITableView width when inside a popover
See below - the tableView cells are getting cut off. Why doesn't this work? The width of the popover is 240.
(In a subclass of UITableViewController)
- (void)viewDidLoad {
[super viewDidLoad];
self.t开发者_JS百科ableView.frame = CGRectMake(0,0,200,200);
}
You have to specify the content size of the ui controller you are displaying. You can do it in 2 ways:
- access the ui controller from your popover controller and set it size:
UIViewController* yourViewController = yourPopOverController.contentViewController; yourViewController.contentSizeInViewController = CGSizeMake(300, 600);
- check the checkbox "Use Explicit Size" for popover in the inspector of the viewController in storyboard
As you see the content ui controller is the one responsible of setting the size of your popover.
Have you tried specifying the popover's content size?
i.e.
self.popoverController.popoverContentSize = CGSizeMake(400, 500);
I've found that while popover's are "suppose" to adjust to the appropriate size based on the content view controller, this doesn't always work as well as it should.
精彩评论