1

I have 2 view controllers and the 2nd view controller has a table view in it I have used storyboard for this purpose and for transition from 1st to 2nd view controller i'm using a popover controller. The problem is since i'm using a table view controller in 2nd view controller, when i click on did select row at index path , a view comes but along with the previous popover size. I'm stuck at this as how to dynamically resize when i click on cell ,Any possible help will be appreciated?

p.s- Please note i'm not using any IBOulet to popover controller and not creating it by code also.Earloer i have used setcontentsize for resizing popovers but with story board i'm stuck.

Mary Zareah
  • 43
  • 1
  • 6

1 Answers1

1

Here are ways you can try

  1. Create ViewController which will be placed in popover, select it and navigate to Utilities pane > Attributes Inspector > Set Size to Freeform

  2. Select popover segue and navigate to Utilities pane > Attributes Inspector > Set Identifier to "yourIdentifier"

FIRST TRY

Change the size of ViewController by selecting its View and navigating to Utilities pane->Size Inspector [see if you can get expected size]

SECOND TRY - Try this inside the view from which you are calling popOverViewController

    UIPopoverController *popover; // define this in .h as ivar

    - (IBAction)buttonPressed:(id)sender 
    {
         UIButton *anchor = (UIButton*)sender;
         UIViewController *viewControllerForPopover = [self.storyboard instantiateViewControllerWithIdentifier:@"yourIdentifier"];    
         popover = [[UIPopoverController alloc] 
               initWithContentViewController:viewControllerForPopover];
         [popover setPopoverContentSize:CGSizeMake(width, height)]; // here see if you can get expected size
         [popover presentPopoverFromRect:anchor.frame 
                                  inView:anchor.superview 
                permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }

THIRD TRY

Please look at Trick by krasnyk (accepted answer) for Forcing Popover Size

Community
  • 1
  • 1
βhargavḯ
  • 9,786
  • 1
  • 37
  • 59
  • Hello i have lost hope on connecting by seque so i used a popover made through code and set its size on a button click.Thanks for the sincere help bhargavi. – Mary Zareah Mar 18 '13 at 07:08