Note that there are some explanatory texts on larger screens.

plurals
  1. POpresentPopoverFromRect causes an empty view, but using segue it works fine
    primarykey
    data
    text
    <p>I am making an iPad app where I programmatically place UIButtons on a UIImageView inside a UIScrollView.</p> <p>When someone pushes one of these buttons I would like to present a UIPopover. Since the buttons have been added programmatically, I also have to present the popover programmatically.</p> <p>Here is my code for presenting the popover:</p> <pre><code>- (void)buttonHandler:(UIButton *)sender { PushButtonViewController *controller = [[PushButtonViewController alloc] initWithButtonID:@"hej"]; _pushButtonPopover = [[UIPopoverController alloc] initWithContentViewController:controller]; _pushButtonPopover.delegate = self; if(![_pushButtonPopover isPopoverVisible]) { [_pushButtonPopover presentPopoverFromRect:sender.bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } else { [_pushButtonPopover dismissPopoverAnimated:YES]; } } </code></pre> <p>This is the initializer of the popover view controller:</p> <pre><code>- (id)initWithButtonID:(NSString *)buttonID { self = [super init]; self.buttonID = buttonID; return self; } </code></pre> <p>The problem is that when I do so, <b>I get an empty popover:</b></p> <p><a href="https://www.dropbox.com/s/q0k1idd5c0roymn/screenshot1.png" rel="nofollow">Screenshot 1 - not working</a></p> <p>However, when I use a pre-inserted button, hooked up with a segue i the Storyboard, <b>everything works just fine:</b></p> <p><a href="https://www.dropbox.com/s/mbuxs6dm2hcewfr/screenshot2.png" rel="nofollow">Screenshot 2 - working fine</a></p> <p>I really hope that you might have some suggestions to what I might be doing wrong. Thank you in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload