当我打电话时:
[self.navigationController pushViewController:SOME_VIEW_CONTROLLER animated:YES];
应用程序随机卡住(它没有崩溃,所以没有错误日志)。尝试过调试它没有结果。
请注意:
pushViewController
类别调用此UIViewController
。
这有什么问题吗?viewDidAppear
将不会被调用(viewWillAppear, viewWillLayoutSubviews, viewDidLayoutSubviews
叫)一些代码段:
- (void)routeToBookingDetailsForCustomer:(BookingModel *)booking {
VTBookingDetailsForCustomerViewController *vc = [VTBookingDetailsForCustomerViewController new];
vc.booking = booking;
[self.navigationController pushViewController:vc animated:YES];
}
刚刚找到另一个类似案例的帖子: pushViewController stuck or viewdidappear fail
答案 0 :(得分:2)
我认为你必须像{<1}}那样传递
Nib name
Nib名称表示你的- (void)routeToBookingDetailsForCustomer:(BookingModel *)booking{
VTBookingDetailsForCustomerViewController *vc = [[VTBookingDetailsForCustomerViewController alloc]initWithNibName:@"VTBookingDetailsForCustomerViewController" bundle:nil];
vc.booking = booking;
[self.navigationController pushViewController:vc animated:YES];
}
你的VTBookingDetailsForCustomerViewController的XIB name
,你必须在XIB name
答案 1 :(得分:0)
你尝试过这种方法吗?
someViewController *someVC = [someViewController alloc] initWithNibName:@"someViewController " bundle:NULL];
someVC.someVariable = someValue;
[self.navigationController pushViewController:someVC animated:YES];
编辑:刚看到&#39; Dipen Chudasama&#39;已经回答了!
答案 2 :(得分:0)
您是否通过实施UIViewControllerInteractiveTransitioning
并结合queries.php
来使用自定义转换动画?
我在自己的应用程序中遇到了这个问题,结果发现我错误地开始了一个我从未完成的交互式转换。在这种情况下,所有调试都显示控制器已被推送,但在我的应用程序更改状态之前UI未更新。
答案 3 :(得分:0)
请在主队列中尝试pushViewController代码。
dispatch_async (dispatch_get_main_queue(), ^{
VTBookingDetailsForCustomerViewController *vc = [VTBookingDetailsForCustomerViewController new];
vc.booking = booking;
[self.navigationController pushViewController:vc animated:YES];
});