之前IOS 6我用下面的代码来呈现模态的视图与定制尺寸:变迁大小与presentViewController正确:动画:完成:
- (void) showModalViewWithController:(GUIViewController*) _viewController {
[UIView beginAnimations:@"" context:nil];
[self presentModalViewController:_viewController animated:YES];
_viewController.view.superview.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_viewController.view.superview.frame = CGRectMake(
_viewController.view.superview.frame.origin.x,
_viewController.view.superview.frame.origin.y,
700.0f,
self.view.frame.size.height - 80.f);
_viewController.view.superview.center = self.view.center;
[UIView commitAnimations];
}
现在我有改变功能
- (void)presentModalViewController: (UIViewController *)viewControllerToPresent animated:(BOOL)flag
到
- (void)presentViewController: (UIViewController *)viewControllerToPresent animated: (BOOL)flag completion: (void (^)(void))completion
不幸的是调整大小后查不正常工作如下所示:
- (void) showModalViewWithController:(GUIViewController*) _viewController {
[self presentViewController:_viewController animated:YES completion:^(){
[UIView beginAnimations:@"" context:nil];
_viewController.view.superview.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_viewController.view.superview.frame = CGRectMake(
_viewController.view.superview.frame.origin.x,
_viewController.view.superview.frame.origin.y,
700.0f,
self.view.frame.size.height - 80.f);
_viewController.view.superview.center = self.view.center;
[UIView commitAnimations];
}];
}
因为模式视图在帧操作之前呈现,并且在调用完成块之后跳转。
如何处理?
由于提前,
米哈尔
发现你试过保持它和以前一样,并留下完成块空白?将所有代码添加到块中应该完全按照您的说法进行操作,呈现视图然后再进行动画演示。 – TheJer
是的,我试图不使用完成块,但它只适用于iOS 5. iOS 6要求额外的屏幕旋转以正确重画视图。 – Kaktusiarz
嗨!任何解决方案我面临同样的问题。谢谢 – Frade