问题描述
我有一个UIViewController,当按下一个按钮时,我想要一个半屏幕视图向上滑动,里面有一个UIPicker。
I have a UIViewController and when a button is pressed, I want a half screen view to slide up with a UIPicker in it.
我在IB中做了一个UIView使用UIPicker和带有完成/取消按钮的UIToolBar。
I made a UIView in IB with the UIPicker along with a UIToolBar with Done/Cancel buttons.
如何才能使这个半视图向上滑动,背景视图仍然显示但是变暗或者不能玩。
How can I make it so that just this half view slides up and the background view is still showing but dimmed or cant be played with.
我到目前为止使用此代码:
I'm using this code so far:
- (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)];
}];
}
这是一张照片:
推荐答案
这就是你需要在github TDSemiModalView
上有一个半视图日期选择器的开源代码。检查代码中的演示项目。这是链接..希望它能解决您的问题。
Here is what u need its an open source code on github TDSemiModalView
having a half view date picker. Check the demo project inside the code. Here is the link.. Hope it solves your problem.
这篇关于如何呈现半屏模态视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!