2
votes

I have a number of apps that have popovers on iPad where when a button is clicked, a popover would appear, resize and show.

Since using iOS7 and xcode 5, when run in simulator, this no longer works, and all that happens is the sreen goes grey like something is loading but not showing correctly.

This runs fine on iOS6 and below however on iOS7 doesnt work anymore!

Code per below, please help!

in my popover .m file

- (void)awakeFromNib
{
    self.contentSizeForViewInPopover = CGSizeMake(450, 90);
    [super awakeFromNib];
}

In my mainviewcontroller .m file:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

{

    //Eraser Popover controls
    if ([[segue identifier] isEqualToString:@"showAlternate"]) {
        [[segue destinationViewController] setDelegate:self];

        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
            UIPopoverController *popoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
            self.EraserPopoverController = popoverController;
            popoverController.delegate = self;
        }
    }
2

2 Answers

3
votes

OK found out the problem... this took ages!! YOu just need to add a line of code within your segue to place to call the popover view on to the button

    [self.YourpopoverController presentPopoverFromRect:YourButtonName.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

That was it!!

2 hours of my life im never going to get back haha

0
votes

Yup in xcode 6 your code works great. Just need to add the iboulets buttons for buttons names on .m file and that is all you do, its a nice solution thanks