Search code examples
iosxcode4.2uipopovercontroller

changing the size of the popover controller when pushing navigation view controller in popover on iPad


I am new in ios developement.I have a main viewController having navigation items while i tap navigation item popover viewcontroller appears fine and gettig exact contentSize For View In Popover(320,845), the problem is when i tap button inside the popover viewcontroller popover Contentsize has to be changed.

UIBarButtonItem *btn = (UIBarButtonItem *)sender;
Agamam *agamamView = [[Agamam alloc] initWithNibName:@"Agamam" bundle:nil];
agamamView.delegate=self;
agamamView.contentSizeForViewInPopover  =CGSizeMake(agamamView.view.frame.size.width, agamamView.view.frame.size.height); 

UINavigationController *navController =  [[UINavigationController alloc] initWithRootViewController:agamamView];
popAgamamView = [[UIPopoverController alloc] initWithContentViewController:navController];
[popAgamamView presentPopoverFromBarButtonItem:btn permittedArrowDirections:YES animated:YES];

Solution

  • Try this....

    - (void)viewWillAppear:(BOOL)animated
    {
       CGSize size = CGSizeMake(320, 845); // size of view in popover
       self.contentSizeForViewInPopover = size;
       [super viewWillAppear:animated];
    }