iOS 关于NavigationController返回的一些笔记
2024-08-23 01:11:21
1、理解NavigationController返回机制
一般NavigationController下的子view只有一层或者有很多层,子view返回最顶层则可以直接用
[self.navigationController popViewControllerAnimated:YES];
如果NavigationController下有好几层子view,当前子view返回上一层,则可以用
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:([self.navigationController.viewControllers count] -)] animated:YES];
-3为上上一层,依此类推。push和pop的方法类似。
2、手势右滑返回上一层
控制器添加代理UIGestureRecognizerDelegate
self.navigationController.interactivePopGestureRecognizer.delegate = self; - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ //判断是否是导航条的第一个子视图控制器
if (self.navigationController && [self.navigationController.viewControllers count] >= ) {
return YES;
}else{
return NO;
}
}
模态、导航栏混合模式
https://www.cnblogs.com/dingding3w/p/6222626.html
最新文章
- C#基础知识二之this关键字
- 黑马程序员——C语言基础 流程控制 选择结构和循环结构
- 可能是Mac环境变量恢复的参考
- python开发 Day1 python基础
- LOB字段存放在指定表空间 清理CLOB字段及压缩CLOB空间
- c#高效的线程安全队列ConcurrentQueue<;T>;(上)
- 父节点使用css的transform: translate(0, 0)时position:fixed在chrome浏览器中无效
- SPRING IN ACTION 第4版笔记-第二章Wiring Beans-005-<;constructor-arg>;和c-namespace
- 服务器后端开发系列——《实战FastDFS分布式文件系统》[转]
- 原生javascript扫雷游戏
- Java 架构师之路(1)
- CF 375D. Tree and Queries【莫队 | dsu on tree】
- Algorithm -->; 十大排序算法
- 知识小罐头08(tomcat8启动源码分析 上)
- Python_每日习题_0006_斐波那契数列
- jdk8-lanbda方法引用和构造引用
- ORA-12560: TNS: 协议适配器错误的解决方法
- POJ 1597 Function Run Fun
- Fang Fang---hud5455(字符串处理)
- windows上安装Gradle并配置环境变量