简体   繁体   中英

How to add UIBarButtonItem action in Popoverview?

i want to show popoverview with UIBarButtonItem action but i cannot add popover segue in storyboard. Because i added UIBarButtonItem programmatically.

Thanks in replies.

在此处输入图片说明

在此处输入图片说明

@property (nonatomic, strong) UIPopoverController *yourPopOverController;

In your action Method.

 UIBarButtonItem *yourButton = (UIBarButtonItem *)sender;

 YourViewController *yourViewControllerObject = [[YourViewController alloc]init];

        yourPopOverController = [[UIPopoverController alloc] initWithContentViewController:yourViewControllerObject];
        yourPopOverController.delegate = self;
        [yourPopOverController presentPopoverFromBarButtonItem:yourButton permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM