这是我的代码。我可以看到出现了一个小对话框,然后对话框占据了整个屏幕。有什么问题?
ChangeProfileImage *changeProfileImage =[[ChangeProfileImage alloc] init];
changeProfileImage.modalPresentationStyle = UIModalPresentationFormSheet;
changeProfileImage.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:changeProfileImage animated:YES];
changeProfileImage.view.superview.frame = CGRectMake(0, 0, 200, 200);//it's important to do this after
changeProfileImage.view.superview.center = self.view.center
答案 0 :(得分:0)
我已准备好告诉你这段代码的所有问题,但随后我设置了一个简单的iPad单视图应用程序,并尝试了以下代码:
- (IBAction)FlipPressed:(id)sender {
UIViewController *vc = [[UIViewController alloc] init];
UIView *view = [vc view];
[view setBackgroundColor:[UIColor redColor]];
[vc setModalPresentationStyle:UIModalPresentationFormSheet];
[vc setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:vc animated:YES];
[[[vc view] superview] setFrame:CGRectMake(0, 0, 200, 200)];
[[[vc view] superview] setCenter:[[self view] center]];
}
当我尝试这个时,我得到一个红色的盒子,200x200,带有圆角,翻转到屏幕中心的视图。
据我所知,我已经完全复制了你的代码,我想我得到了你想要的结果,对吗?
修改/更新强> 的
进一步测试似乎表明此代码仅在iPad处于纵向方向时才能正常工作。否则,我的视图似乎是“垂直”翻转(关于iPad的方向)并且视图不居中。