iPhone中使用popover功能

来源:互联网 发布:bluestacks mac怎么用 编辑:程序博客网 时间:2024/05/27 00:29

popover功能最早出现在iPad中

- (IBAction)btnClicked:(id)sender {    PopTableViewController *pop = [[PopTableViewController alloc]init];//popover出来的控制器    pop.preferredContentSize = CGSizeMake(100, 100);//popover出来的控制器的尺寸    pop.modalPresentationStyle = UIModalPresentationPopover;//显示方式    UIPopoverPresentationController *popover = pop.popoverPresentationController;    popover.delegate = self;//遵循UIPopoverPresentationControllerDelegate    popover.barButtonItem = self.navigationItem.rightBarButtonItem;    popover.permittedArrowDirections = UIPopoverArrowDirectionAny;    [self presentViewController:pop animated:YES completion:nil];}#pragma mark - UIPopoverPresentationControllerDelegate代理方法- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller{    return UIModalPresentationNone;}

这样可在iPhone中实现popover功能
这里写图片描述

0 0
原创粉丝点击