presentModalViewController使用 UIModalPresentationFormSheet,无法改变frame大小
2015-04-13 11:29
537 查看
TestViewController *testVC = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
testVC.modalPresentati*****tyle = UIModalPresentationFormSheet;
testVC.modalTransiti*****tyle = UIModalTransiti*****tyleCrossDissolve;
[self presentModalViewController:testVC animated:YES];
testVC.view.superview.frame = CGRectMake(0, 0, 649, 397);//it's important to do this after presentModalViewController
testVC.view.superview.center = self.view.center;
注意:/it's important to do this after presentModalViewController
可以按以上方法实现。
用另外一种方式,你用的这种是针对整个controller的,你可以用[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
// forView:theView cache:YES];
iOS8 不能设置frame
testVC.modalPresentati*****tyle = UIModalPresentationFormSheet;
testVC.modalTransiti*****tyle = UIModalTransiti*****tyleCrossDissolve;
[self presentModalViewController:testVC animated:YES];
testVC.view.superview.frame = CGRectMake(0, 0, 649, 397);//it's important to do this after presentModalViewController
testVC.view.superview.center = self.view.center;
注意:/it's important to do this after presentModalViewController
可以按以上方法实现。
用另外一种方式,你用的这种是针对整个controller的,你可以用[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
// forView:theView cache:YES];
iOS8 不能设置frame
UIViewController* modalController = [[UIViewController alloc]init]; modalController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; modalController.modalPresentationStyle = UIModalPresentationFormSheet; CGPoint frameSize = CGPointMake([[UIScreen mainScreen] bounds].size.width*0.95f, [[UIScreen mainScreen] bounds].size.height*0.95f); CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenRect.size.width; CGFloat screenHeight = screenRect.size.height; // Resizing for iOS 8 modalController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y); // Resizing for <= iOS 7 modalController.view.superview.frame = CGRectMake((screenWidth - frameSize.x)/2, (screenHeight - frameSize.y)/2, frameSize.x, frameSize.y); UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; [vc presentViewController:modalController animated:YES completion:nil];
相关文章推荐
- presentModalViewController使用 UIModalPresentationFormSheet,无法改变frame大小
- UIModalPresentationFormSheet 改变加变大小
- testVC.modalPresentationStyle = UIModalPresentationFormSheet; 更改 VC大小
- 正确使用PresentModalViewController
- 正确使用PresentModalViewController
- IPad使用UIModalPresentationFormSheet时隐藏键盘
- 在presentModalViewController中使用UINavigationController
- 正确使用PresentModalViewController
- 正确使用PresentModalViewController
- presentModalViewController和dismissModalViewControllerAnimated的使用总结
- iOS开发presentModalViewController ,若有UITextField,键盘无法下去的问题
- presentModalViewController的使用
- iOS: Warning: Attempt to present <ModalViewController> on <ViewController>while a presentation is in
- presentModalViewController和dismissModalViewControllerAnimated的使用总结
- IOS: 正确使用PresentModalViewController
- 正确使用PresentModalViewController
- 使用 presentModalViewController 异常
- presentModalViewController和dismissModalViewControllerAnimated的使用总结
- 正确使用PresentModalViewController
- presentModalViewController和dismissModalViewControllerAnimated的使用总结