首页 > 技术文章 > testVC.modalPresentationStyle = UIModalPresentationFormSheet; 更改 VC大小

Camier-myNiuer 2014-07-01 16:59 原文

 

本文转载至 http://www.cocoachina.com/bbs/simple/?t31199.html

TestViewController *testVC = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
    testVC.modalPresentationStyle = UIModalPresentationFormSheet;
    testVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [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

 

 

 

 

 TestViewController *testVC = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
    testVC.modalPresentationStyle = UIModalPresentationFormSheet;
    testVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:testVC animated:YES];
    testVC.view.superview.frame = CGRectMake(0, 0, 649, 397);//it's important to do this after presentModalViewController
....... 

K,问题解决。。。还一定要在[self presentModalViewController:testVC animated:YES];之后设置frame的大小!!

推荐阅读