#import "TestViewController.h"
#import "OneViewController.h"

在TextViewController写入点击事件:

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self click];
}
- (void)click
{
    OneViewController * vc = [OneViewController new];

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

    NSLog(@"%@",NSStringFromClass([self.presentationController class]));
    NSLog(@"%@",NSStringFromClass([self.presentedViewController class]));
    NSLog(@"%@",NSStringFromClass([self.presentingViewController class]));

    NSLog(@"%@",NSStringFromClass([vc.presentationController class]));
    NSLog(@"%@",NSStringFromClass([vc.presentedViewController class]));
    NSLog(@"%@",NSStringFromClass([vc.presentingViewController class]));

}

打印结果:

-- :::] _UIFullscreenPresentationController
-- :::] OneViewController
-- :::] (null)
-- :::] _UIFullscreenPresentationController
-- :::] (null)
-- :::] TestViewController

在OneViewController的ViewDidAppear写入:

- (void)viewDidAppear:(BOOL)animated
{

    NSLog(@"%@",NSStringFromClass([self.presentationController class]));
    NSLog(@"%@",NSStringFromClass([self.presentedViewController class]));
    NSLog(@"%@",NSStringFromClass([self.presentingViewController class]));

}

打印结果:

-- :::] _UIFullscreenPresentationController
-- :::] (null)
-- :::] TestViewController

总结:

presented 和 presenting 都是相对于当前UIViewController自己的。

我的理解,presented就是当前UIViewController有权利弹出的VC对象,presenting就是把当前UIViewController给弹出的对象。

我再理解了一下,presented就是当前UIViewController的儿子

        presenting就是当前UIViewController的老子

以上都是我的理解,希望前辈指点

UIViewController 的 presentedViewController 和 presentingViewController的更多相关文章

  1. presentedViewController 和 presentingViewController 以及 dismissViewControllerAnimated 的使用

    在日常的开发中,多控制器之间的跳转除了使用push的方式,还可以使用 present的方式,present控制器时,就避免不了使用 presentedViewController.presenting ...

  2. iOS presentedViewController和presentingViewController的区别

    当我们用present进行界面跳转时,会涉及到一个传向关系. 比如:A -> B    界面A跳转界面B A.presentedViewControlle = B B.presentingVie ...

  3. presentingViewController、presentedViewController区别

    解释两个属性:presentingViewController 和 presentedViewController A----(present)-----B----(present)-----C 1. ...

  4. 你真的了解UIViewController跳转吗?

    一:UIViewController模态跳转 //展示模态视图 - (void)presentViewController:(UIViewController *)viewControllerToPr ...

  5. [转]iOS之浅谈纯代码控制UIViewController视图控制器跳转界面的几种方法

    参考:http://www.mamicode.com/info-detail-469709.html 一.最普通的视图控制器UIViewContoller 一个普通的视图控制器一般只有模态跳转的功能( ...

  6. iOS之浅谈纯代码控制UIViewController视图控制器跳转界面的几种方法

    .最普通的视图控制器UIViewContoller 一个普通的视图控制器一般只有模态跳转的功能(ipad我不了解除外,这里只说iPhone),这个方法是所有视图控制器对象都可以用的,而实现这种功能,有 ...

  7. UIViewController之间的相互跳转

    一.最普通的视图控制器UIViewContoller 一个普通的视图控制器一般只有模态跳转的功能(ipad我不了解除外,这里只说iPhone),这个方法是所有视图控制器对象都可以用的,而实现这种功能, ...

  8. Swift开发小技巧--自定义转场动画

    自定义转场动画 个人理解为重写了被弹出控制器的modal样式,根据自己的样式来显示modal出来的控制器 例:presentViewController(aVC, animated: true, co ...

  9. iOS 视图控制器转场详解

    iOS 视图控制器转场详解 前言的前言 唐巧前辈在微信公众号「iOSDevTips」以及其博客上推送了我的文章后,我的 Github 各项指标有了大幅度的增长,多谢唐巧前辈的推荐.有些人问我相关的问题 ...

随机推荐

  1. 使用spring boot和thrift、zookeeper建立微服务

    Spring cloud适应于云端服务,也适用于企业信息化SOA建设.spring boot也是restful微服务开发的利器.但对于内网服务,即服务与服务之间的调用,spring并没有去刻意封装,也 ...

  2. js单选和复选框

    http://blog.csdn.net/chelen_jak/article/details/44827393 http://www.gbtags.com/technology/jquerynews ...

  3. EF增删改查操作

    增 using (StudentEntities ent = new StudentEntities()) { User aNewUser = new User() { Age = , Name = ...

  4. [AJAX系列]onreadystatechange事件

    onreadystatechange事件: 当请求被发送到服务器时,我们需要执行一些基于响应的任务 每当readyState改变时,就会触发onreadystatechange事件 readyStat ...

  5. iOS -- 神战

    http://github.ibireme.com/github/list/ios/# https://github.com/Tim9Liu9/TimLiu-iOS http://www.ios122 ...

  6. linux android真机测试

    1. 在终端运行 lsusb 会发现结果有会有如下类似记录: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 ...

  7. [转]浅谈jQuery EasyUI的属性设置

    原文地址:http://www.easyui.info/archives/1664.html 对jQuery EasyUI有一定了解的话,应该知道基本上每一个组件都有一个"options&q ...

  8. Shell脚本_启动停止重启sh脚本

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...

  9. 神经网络dropout

    训练集上面,加一个bool型的开关 做预测的时候,不需要打开开关,而是所有的数乘以p, 实际工业界做的时候是: 在训练的时候都除以p,在做预测的时候什么时候都不用干

  10. python中的函数以及递归

    一  函数 函数的组成: def funname(parameters): instructions.... 在探讨函数的定义之前,让我们想想,如果我们写了上千行代码,其实各种变量定义,循环..... ...