GCD高级编程例子
来源:互联网 发布:数据库开发工程师简历 编辑:程序博客网 时间:2024/09/21 09:24
两种方法,实现一件事情做完,再做另外一件事情。
1、
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController popToRootViewControllerAnimated:NO];
});
dispatch_barrier_async(dispatch_get_main_queue(), ^{
[[[AppDelegate getDelegate] tabbarController] setSelectedIndex:0];
});
2、
dispatch_group_t group =dispatch_group_create();
dispatch_group_async(group,dispatch_get_main_queue(), ^{
[self.navigationControllerpopToRootViewControllerAnimated:NO];
});
dispatch_group_notify(group,dispatch_get_main_queue(), ^{
[[[AppDelegategetDelegate]tabbarController]setSelectedIndex:0];
});
出现问题的代码如下:
[self.navigationController popToRootViewControllerAnimated:NO];
[[[AppDelegate getDelegate] tabbarController] setSelectedIndex:0];
由于导航控制器里面的子控制器比较多,第一句话执行的时间比较长,当第二句执行完时,第一句还没有执行完。导致再次切换tabbarController时出现崩溃的现象。
1 0
- GCD高级编程例子
- 【读书笔记】Objective-C高级编程--GCD概要
- 【《Objective-C 高级编程》 学习笔记--GCD】
- 《Objective-C 高级编程》读书笔记之 GCD
- Objective-C高级编程读书笔记之GCD
- unix高级编程例子配置
- 【读书笔记】Objective-C高级编程--GCD的API
- 【读书笔记】Objective-C高级编程--GCD实现1
- Objective-c高级编程GCD学习笔记(1)
- 《Objective-C 高级编程》干货三部曲(三):GCD篇
- <iOS读书笔记>之Objective-C高级编程(GCD)
- GCD编程(封装GCD)
- GCD编程
- GCD编程
- GCD编程
- GCD编程
- GCD 编程
- GCD高级用法 dispatch_semaphore
- 完美实现类似QQ的自拍头像、上传头像功能!
- 孙悟空颠覆式创业为什么注定要失败
- 致牛顿
- Caffe+Ubuntu 13.10+ CUDA6.5 安装指南
- PHPExcel整合到ZF2
- GCD高级编程例子
- 迭代器和迭代器类型 begin和end操作 vector迭代器自增和解引用
- 单目相机重建场景的若干问题
- 聊聊高并发(二十八)解析java.util.concurrent各个组件(十) 理解ReentrantReadWriteLock可重入读-写锁
- 程序猿之---C语言细节17(求time_t的最大值、strlen求的是长度、malloc分配字符内存细节、switch的中default细节)
- 创建和关闭进程
- ios 静态库编译总结
- Rapberry pi apt-get 死活更新不成功
- windows10简单试用<多图,连薛定谔的猫都杀死了>