我正在尝试呈现一个只有一半高度的 View Controller
[self presentModalViewController:menu animated:YES];
问题是当它被呈现时, View Controller 结束时与屏幕大小相同。 我也试过将“菜单”设置为屏幕的全尺寸并将 View 的透明度更改为白色,但这也不起作用。
最佳答案
只需将核心动画或动画过渡与屏幕大小一半的 UIView 一起使用。您需要将持有者 View 添加到主视图。
将半尺寸 View 放在屏幕下方(halfView.y = 480 或 320,具体取决于方向)。
向上动画。
可能是这样的:
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromBottom];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[holderView addAnimation:animation forKey:@"SwitchToView1"];
关于iphone - 呈现一个屏幕大小一半的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5805816/