您的位置:首页 > 运维架构

iPhone中使用popover功能

2016-03-04 16:43 686 查看
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功能

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iphone