UIPresentationController

UIPresentationController
1> 管理所有Modal出来的控制器
2> 管理所有通过- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion方法显示出来的控制器
3> 管理\监听切换(切换的时刻)控制器的过程
4> presentingViewController:后面的控制器
5> presentedViewController:前面的控制器
6> presentedView:前面的控制器的view

UIPresentationController有两个非常重要的属性:
   prentingViewController:源控制器
   presentedViewCotroller:目标控制器
   persetnedView:目标控制器的view
可以用这个几个属性实现切换动画。

管理控制器的切换的切换示例:
@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    HMSecondViewController *second = [[HMSecondViewController alloc] init];
//Popover形式显示
//    second.modalPresentationStyle = UIModalPresentationPopover;//一定先向设置<span style="font-family: Arial, Helvetica, sans-serif;">modalPresentationStyle,后面的</span><span style="font-family: Arial, Helvetica, sans-serif;">popoverPresentationController才生效</span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;">
</span>//    second.popoverPresentationController.barButtonItem = self.navigationItem.leftBarButtonItem;//以popver显示在leftBarButtonItem下面
    [self presentViewController:second animated:YES completion:nil];
    NSLog(@"%@ %@", second.presentationController, second.popoverPresentationController);
}

// 1.只要调用了[self presentViewController:second animated:YES completion:nil];方法
// 2.首先会创建一个UIPresentationController
// 3.然后由UIPresentationController管理控制器的切换

@end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值