So here's my problem.
I want to present a popover from a navigationbarbutton(works fine).
The contentviewcontroller of the popover is a UINavigationController with a UITableViewController as it's rootviewcontroller.
The presentation works fine.
Now i select a cell of the tableview, which leads another viewcontroller to be pushed onto the navigation-stack.
The viewcontroller will be pushed correctly, but now here appears a weird thing.
The popover will start getting resized(without animation) before the content is getting resized(with animation).
This is how i create my popover and present it:
UINavigationController* adsl_navctl = [[[UINavigationController alloc] initWithRootViewController:adsl_newnedit] autorelease];
self.adsc_current_popover = [[[dsd_popover_controller alloc] initWithContentViewController:adsl_navctl] autorelease];
_adsc_current_popover.delegate = self;
[adsl_newnedit.tableView layoutIfNeeded];
_adsc_current_popover.popoverContentSize = CGSizeMake(_adsc_current_popover.popoverContentSize.width, adsl_newnedit.tableView.contentSize.height + 38);
[_adsc_current_popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Here's how i resize my popover. self.contentSizeForViewInPopover isn't set anywhere else yet.
This is in all viewcontrollers, which are presented in the uinavigationcontroller. The size isn't the same everytime of course.
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[UIView animateWithDuration:0.3 animations:^{
[self forcePopoverSize];
}];
}
}
- (void)forcePopoverSize {
CGSize currentSetSizeForPopover = CGSizeMake(320, self.tableView.contentSize.height);
CGSize fakeMomentarySize = CGSizeMake(currentSetSizeForPopover.width - 1.0f, currentSetSizeForPopover.height - 1.0f);
self.contentSizeForViewInPopover = fakeMomentarySize;
self.contentSizeForViewInPopover = currentSetSizeForPopover;
}
Some screenshots so you can understand my problem better(sorry new user, so cant post pics directly).
https://i.stack.imgur.com/copoA.png
https://i.stack.imgur.com/zJN1b.png
The content still is the size of the previous popover size even when the popover already resized. Normally it should resize both at the same time
Edit: After some time, i tried to look onto this again and i finally found a solution for me. In this Question the answer by "adnako" solved my problem.