zoukankan      html  css  js  c++  java
  • iOS iOS8新特性--UIPresentationController

    1. UIPresentationController的作用

      1>管理所有Modal出来的控制器

      2>管理通过这个方法  - (void) presentViewController:(UIViewController *) animated:(BOOL) completion:^(void)completion;显示出来的控制器

      3>管理监听 切换控制器的过程

    2. UIPresentationController的作用

      1>控制器一旦调了present方法,控制器的presentationController,会先创建好了,然后整个控制器的切换由presentationController管理

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

        SecondViewController *vc = [[SecondViewController alloc]init]; 

        [self presentViewController:vc animated:YES completion:nil];

    }

     

      2>控制器有2个属性:presentationController和poppverPresentationController

        下面的截图场景 vc.modalPresentationStyle = UIModalPresentationFormSheet, 这种情况下poppverPresentationController = nil 

      

      3>设置控制器以popver的方式切换.

        也就是说 vc.modalPresentationStyle = UIModalPresentationPopover,控制器的popoverPresentationController属性就不再是nil了

        而且popoverPresentationController 和 presentationController 指向同一对象,指向的都是 UIPopoverPresentationController 类对象

        注: 1>UIPopoverPresentationController类 继承自 UIPresentationController类

            2>父类指针可以指向子类,所以presentationController指向UIPopoverPresentationController对象,没有问题

      4>控制器的presentationController 和 popoverPresentationController采用的是懒加载的方式,下面这段代码,vc控制器是不会popover出来的.

        SecondViewController *vc = [[SecondViewController alloc]init];

        // 在 vc.popoverPresentationController.sourceView = self.segmented之前调了presentationController的get方法

      vc.presentationController; 

        vc.modalPresentationStyle = UIModalPresentationPopover;

        vc.popoverPresentationController.sourceView = self.segmented;

        [self presentViewController:vc animated:YES completion:nil];

  • 相关阅读:
    jsp%不能解析
    hibernate映射数据库时@ManyToOne和@OneToMany
    PSP需求分析文档
    医院挂号系统前景与范围文档
    PSP个人软件开发工具需求分析文档
    英雄联盟战队管理系统项目前景与范围文档
    在学习抛出异常的过程中,关于错误信息 TypeError: exceptions must derive from BaseException 的原因
    python面向对象__slots__变量的运用
    初学过程中,对于python if__name__=='main'的作用
    使用C模拟面向对象实现如java的LinkedList集合(好精彩)
  • 原文地址:https://www.cnblogs.com/oumygade/p/4279532.html
Copyright © 2011-2022 走看看