简体   繁体   English

如何在现有的View上添加一个小的UIView(类似于弹出窗口)?

[英]How to add a small UIView(Something like a pop-up window) on existing View?

I want to add a Customized UIView that will take Text input from user. 我想添加一个自定义UIView,它将接受用户的文本输入。 I tried this by creating a new UIViewController which can take text input. 我通过创建一个可以接受文本输入的新UIViewController进行了尝试。 But when I Navigation Controller to show this View it occupies entire screen. 但是当我导航控制器显示此视图时,它占据了整个屏幕。 I dont want entire screen to be covered by new view. 我不希望整个屏幕都被新视图覆盖。 any suggestions? 有什么建议么?

Thanks for the help in advance. 我在这里先向您的帮助表示感谢。

使用[parentView addSubview:smallView]

Use an UIAlertView and add text fields to it? 使用UIAlertView并向其中添加文本字段? Or declare a UIView in your .h file, and link it in the XIB file, then when the user needs to be brought to this view: 或在.h文件中声明UIView,并在XIB文件中链接它,然后在需要将用户带到该视图时:

[self.view bringSubviewToFront:textFieldView];

And you are still in the same view, so you can always go back to the original view itself: 而且您仍然处于同一视图中,因此您始终可以返回到原始视图本身:

[self.view sendSubviewToBack:textFieldView];

Hope this helps! 希望这可以帮助!

我已经使用TSAlertView接受用户输入,它显示了类似于UIAlertView的视图,但是带有UITextField

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM