如何呈现半屏模态视图? [英] How To Present Half Screen Modal View?

查看:519
本文介绍了如何呈现半屏模态视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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)];
    }];
}

这是一张照片: http://www.box.net/shared/static/08ji4s0f6i1b8qubrtz6.png

推荐答案

这就是你需要在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.

TDSemiModalClass

这篇关于如何呈现半屏模态视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆