I have a UIViewController
that contains a UITableView
.
This UIViewController
is being displayed in a UIPopoverController
.
Well, In the end i did something that I'm not sure if it's the right thing to do, but it is working.
I added a reference in my contentViewController to the popoverController:
@property (nonatomic , assign) UIPopoverController *popoverControllerContainer;
Then, I added the resizing code to viewWillAppear and viewDidAppear:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView reloadData];
}
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.contentSizeForViewInPopover = self.tableView.contentSize;
}
-(void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.popoverControllerContainer setPopoverContentSize:self.contentSizeForViewInPopover animated:YES];
}
So, keeping a reference to the popover is kind of hack-ish, so I'm open to hear better ideas.