本文转载至 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的大小!!