Wednesday, May 22, 2013

Solution for popover resizing issue

If you have two controller which are A and B ,open with UIpopover but size is different and which are loaded to navigation stack as first load A controller and then load B controller but B controller size is greater than A controller.When you pushing controllers to navigation stack the issue is not happen.But after coming back through the navigation controller(pop the controllers in stack) popover size is not changed.its size is taken last pushed controller size(B). This issue is ios because popover is not taken current controller size.

So solution is use A controller viewDidAppear function and forcefully changed the size and then again rechange then your issue is solved.

Example :


- (void)forcePopoverResize
{
    CGSize currentSetSizeForPopover = self.contentSizeForViewInPopover;
    CGSize tempPopoverSize = CGSizeMake(currentSetSizeForPopover.width - 1.0f, currentSetSizeForPopover.height - 1.0f);
    self.contentSizeForViewInPopover = tempPopoverSize;
    self.contentSizeForViewInPopover = currentSetSizeForPopover;
}

You can call this function inside the viewDidAppear

[self  forcePopoverResize];

Now your problem is solved :)

No comments:

Post a Comment