首页 > 移动平台 > 详细

iOS8新特性(1)-UIPopoverPresentationController使用

时间:2017-01-04 23:16:05      阅读:314      评论:0      收藏:0      [点我收藏+]

从iOS 8开始,苹果提出新的 UIPopoverPresentationController代替UIPopoverController:

技术分享

新的UIPopoverPresentationController使用方法如下:

    // 创建将要显示的Controller
    DJCategoryViewController *categoryVC = [[DJCategoryViewController alloc] init];
    // 设置控制器View的显示大小
    categoryVC.preferredContentSize = CGSizeMake(300, 360);
    // 设置Modal类型
    categoryVC.modalPresentationStyle = UIModalPresentationPopover;
    // 获取Popover
    UIPopoverPresentationController *categoryPopover = categoryVC.popoverPresentationController;
    // 相对于哪个View来显示
    categoryPopover.sourceView = self.categoryItem.customView;
    // 显示位置
    categoryPopover.sourceRect = self.categoryItem.customView.bounds;
    // 设置popover箭头的显示方向
    categoryPopover.permittedArrowDirections = UIPopoverArrowDirectionAny;
    // 跳转
    [self presentViewController:categoryVC animated:YES completion:nil];

 

iOS8新特性(1)-UIPopoverPresentationController使用

原文:http://www.cnblogs.com/yongdaimi/p/6250337.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!