如何制作这样的自定义模态 uiview?
我需要在 iPhone 应用程序上显示一些模式视图,其中我将显示几个标签、一个 UIImageView 和两个按钮。设计需要完全定制。 这是自定义的 UIAlertView 吗?如何制作类似的东西?
I need some modal view on iPhone app where I will display few labels, one UIImageView and two buttons. Design needs to be whole custom.
Is this custom UIAlertView? How to make something similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Jeff LaMarche 有一篇不错的博客文章,介绍了如何创建自定义警报视图。你可以从那里获得灵感。
http://iphonedevelopment.blogspot.com/2010/05/custom- Alert-views.html
** 2017 年 4 月 24 日更新 **
不幸的是,该博客已不存在。不过,您可以从网络档案中检索该帖子:
https://web.archive.org/web/20160430051146/http://iphonedevelopment.blogspot.com/2010/05/custom-alert-views.html
There is a nice blog post by Jeff LaMarche about how to create a custom Alert View. You can take inspiration from there.
http://iphonedevelopment.blogspot.com/2010/05/custom-alert-views.html
** UPDATE on April 24, 2017 **
Unfortunately the blog doesn't exist anymore. However you can retrieve the post from the Web Archive:
https://web.archive.org/web/20160430051146/http://iphonedevelopment.blogspot.com/2010/05/custom-alert-views.html
请参阅 Tapku 库的源代码。他们有这个选项 - 你可以随时修改/调整它的源代码。但这并不困难,只是周围有很多层魔法(例如晕影效果)。大多数资产都是图像。你只需要正确地分解它。
See the source for Tapku library. They have this option - you can always hack/tweak source code for it. Its not that difficult though, Just a lot of layer magic going around (e.g. the vignette effect). and most of the assets are images. You just need to break it down properly.
您只需按照以下步骤即可获得它:
3.现在您可以在ViewB上添加任何视图。
最后,您可以在需要时呈现此视图。效果是,ViewA 将覆盖背景视图控制器,ViewB 将作为背景视图控制器的抑制效果,B 上的视图是您将看到的 UIElement。
You can acquire that simply following the following steps
3.Now you can add any view on ViewB.
Finally you can Present this view where ever required. The effect will be, ViewA will cover the Background viewController, ViewB will server as suppressing effect for background view controller and views on B are the UIElement you will see.
制作这样的视图很简单。您只需要使用您想要的部分创建一个自定义视图,然后将其隐藏或将 alpha 设置为 0.0。然后当你想使用它时取消隐藏它。
为了防止与视图后面的其他项目交互,请在自定义视图后面放置一个空白的半透明视图。
Making a view like this is simple. You just need to create a custom view with the pieces that you want and just make it hidden or set the alpha to 0.0. Then un-hide it when you want to use it.
To prevent interaction with other items behind the view put a blank semi-transparent view right behind your custom view.