我有一个UIViewController,当一个按钮被按下时,我想要一个半屏幕视图向上滑动一个UIPicker。如何呈现半屏模态视图?
我用UIPicker在IB中制作了一个UIView,以及带有Done/Cancel按钮的UIToolBar。
我该如何做到这一点,以便这半视图上滑,背景视图仍然显示,但暗淡或无法播放。
我使用这个代码至今:
- (void)showModalView
{
[self.popupView setFrame:CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:self.popupView];
[UIView animateWithDuration:.2 animations:^{
[self.popupView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
}];
}
这里是一个事先知情同意:http://www.box.net/shared/static/08ji4s0f6i1b8qubrtz6.png