之前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