我有一个需要一秒钟才能执行的segue。目标视图控制器相当大,但即使我注释掉整个viewDidLoad
函数,它仍然需要很长时间。这可能是因为拥有太多的房产和进口产品吗? (我每个人大约30个)
这是相对时间范围内事件的痕迹:
00:00:00.000 Performing segue
00:00:01.297 View did load
00:00:01.315 View did appear
我尝试过的事情:
viewDidLoad
prepareForSegue
viewWillAppear
(不是它应该有所作为)我在iPhone 6 Plus上运行它。
修改
segue正在这样执行:
- (void)checkForPermissions
{
[self.permissionsUIGateway checkCameraPermissionSettingsFromViewController:self completionHandler:^(BOOL granted) {
if (granted)
{
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:@"goToCamera" sender:self];
});
}
}];
}
编辑2:
我发现使用presentViewController:animated:completion
或将以模态方式更改为 Show 的segue会使延迟完全消失。这解决了我的问题,但我会将问题保持开放,因为我仍然不知道为什么会解决这个问题。