1、view里实现控制器的modal

  • 拿到主窗口的根控制器,用根控制器进行modal需要的modal的控制器

    • 场景:点击自定义view里的按钮实现控制器的modal

UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController;
[root presentViewController:<#(nonnull UIViewController *)#> animated:YES completion:nil];

2、主流框架下 ,自定义view里实现控制器的push

  • 拿到主窗口的根控制器UITabBarController,用UITabBarController 选中的控制器(导航控制器)进行push

UITabBarController *tabBarVc = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *nav = (UINavigationController *)tabBarVc.selectedViewController;
[nav pushViewController:<#(nonnull UIViewController *)#> animated:YES];

3、主流框架下,自定义view里利用到UITabBarController控制器 modal 出来的导航控制器push

  • modal 关系

UIViewController *a ;
UIViewController *b ;
[a presentViewController:b animated:YES completion:nil];
b.presentingViewController (该属性指向) -> a
a.presentedViewController (该属性指向) -> b
  • 做法

UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *nav = (UINavigationController *)root.presentedViewController;
[nav pushViewController:<#(nonnull UIViewController *)#> animated:YES];

iOS 自定义view里实现控制器的跳转的更多相关文章

  1. iOS Programming View Controllers 视图控制器

    iOS Programming View Controllers  视图控制器  1.1  A view controller is an instance of a subclass of UIVi ...

  2. ios自定义View自动布局时计算大小

    https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Impleme ...

  3. IOS Note - View Controller(视图控制器)

    Application Delegate(应用程序委托) Application Name: SingleView SingleViewAppDelegate.h #import <UIKit/ ...

  4. Android 自定义 view(四)—— onMeasure 方法理解

    前言: 前面我们已经学过<Android 自定义 view(三)-- onDraw 方法理解>,那么接下我们还需要继续去理解自定义view里面的onMeasure 方法 推荐文章: htt ...

  5. Android 自定义view中的属性,命名空间,以及tools标签

    昨日看到有人在知乎上问这3个琐碎的小知识点,今天索性就整理了一下,其实这些知识点并不难,但是很多开发者平时很少注意到这些, 导致的后果就是开发的时候 经常会被ide报错,开发效率很低,或者看开源代码的 ...

  6. andorid 自定义view属性declare-styleable

    1. reference:参考某一资源ID. (1)属性定义: <declare-styleable name = "名称"> <attr name = &quo ...

  7. Android初级教程初谈自定义view自定义属性

    有些时候,自己要在布局文件中重复书写大量的代码来定义一个布局.这是最基本的使用,当然要掌握:但是有些场景都去对应的布局里面写对应的属性,就显得很无力.会发现,系统自带的控件无法满足我们的要求,这个时候 ...

  8. iOS回顾笔记(03) -- 自定义View的封装和xib文件的使用详解

    iOS回顾笔记(03) -- 自定义View的封装和xib文件的使用详解 iOS开发中,我们常常将一块View封装起来,以便于统一管理内部的子控件.如iOS回顾笔记(02)中的"书" ...

  9. .net MVC微信开发自定义View类型菜单时在相应控制器获取用户OpenID的问题

    因为公司的项目在接收微信服务器Post过来的数据包是有指定的入口,所以在相应控制器里无法接收到微信服务器Post过来的数据,所以无法获得OpenID,也尝试过先在入口哪里解析获得OpenID再通过Se ...

随机推荐

  1. HTML之一 符号实体

    符号实体和”语言代码“以及”字符集“无关.

  2. Swift2.0 中的String(三):类型转换

    本系列第三篇,String相关的类型转换.其他的几篇传送门(GitHub打不开链接的同学请自行把地址github改成gitcafe,或者直接去归档里找:-P): Swift2.0 中的String(一 ...

  3. 安装jasperwave出错

    1.错误描写叙述 2.错误原因 无法下载"com.jasperwave.engine_1.1.0.jar",须要又一次下载 3.解决的方法 将"com.jasperwav ...

  4. 标准库 - fmt/scan.go 解读

    // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a B ...

  5. ubuntu thrift 0.9.3编译安装

    Table of Contents 1. 下载thrift源代码 2. 编译并安装 3. 运行测试程序 4. 安装 1 下载thrift源代码 git clone https://git-wip-us ...

  6. 使用docker-hub

    使用docker hub 需要其账号 基本操作 查找镜像 sudo docker search centos 每个用户有自己的命名空间,如:centos是存仓库中的镜像文件,admln/centos则 ...

  7. SqlServer 之 查看表空间

    一.用到系统视图 sys.sysindexes 该视图定义如下: CREATE VIEW sys.sysindexes AS SELECT id, status = convert(int, end ...

  8. c#删除转义字符的方法,删除\0后所有字符串(菜鸟级别)

    string str = "78738\01212"; string str_2= Regex.Unescape(str); int index = str_2.IndexOf(& ...

  9. Triangular Sums

    描述 The nth Triangular number, T(n) = 1 + … + n, is the sum of the first n integers. It is the number ...

  10. [Java] String.Split 方法的6个重载函数

    String.Split 方法有6个重载函数: 程序代码 1) public string[] Split(params char[] separator) 2) public string[] Sp ...