ada*_*101 2 animation ipad uipopovercontroller ios
我有一个UIPopoverController,我在其中推送UiNavigationController,然后根据需要推送后续的视图控制器.如果所有视图的首选内容大小相同但是当UIPopOver需要扩展以支持更大的首选内容大小时动画速度极慢,则此方法很有用.我已经在模拟器和多代iPad上测试了这一切,结果相同,一个2-3秒的动画,而UIPopover扩展视图以支持更大的视图控制器.
我怎样才能加快这个动画的速度?
OTBAddNewClassViewController *addVC = [[OTBAddNewClassViewController alloc]initWithNibName:@"addNewClass" bundle:nil];
[addVC setPreferredContentSize:CGSizeMake(320, 220)];
[addVC setDelegate:self];
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:addVC];
self.popVC = [[UIPopoverController alloc]initWithContentViewController:navController];
[self.popVC setDelegate:self];
NSInteger popWidth = addVC.view.frame.size.width;
[self.popVC presentPopoverFromRect:CGRectMake(0, 0, popWidth, addVC.view.frame.size.height) inView:self.tableView permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
Run Code Online (Sandbox Code Playgroud)
你需要设置delegate你的UINavigationController,然后覆盖navigationController:willShowViewController:animated:并做这样的事情:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
CGSize contentSize = viewController.preferredContentSize;
[self.popVC setPopoverContentSize:contentSize animated:YES];
}
Run Code Online (Sandbox Code Playgroud)