两种方法,实现一件事情做完,再做另外一件事情。
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];