How to show button popover on iPad

CGRect contentRect = CGRectMake(0, 0, 200, 40);
UIButton *source = [UIButton buttonWithType:UIButtonTypeCustom];
source.frame = contentRect;

source.titleLabel.text = @”Delete”;

source.backgroundColor = [UIColor redColor];

UIViewController* popoverContent = [[UIViewController alloc] init];
popoverContent.view = source;

popoverContent.contentSizeForViewInPopover = contentRect.size;

UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];

[popoverController presentPopoverFromRect:[sender frame]

[popoverContent release];

Blogged with the Flock Browser

Tags: , ,

One Response to “How to show button popover on iPad”

  1. Stephanie Says:

    Thanks for this 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: