如何用笔尖制作伪警报视图?
我想在屏幕上放置一个伪 UIAlertView,它只是一个 UIView 加上我用 IB 创建的笔尖中的按钮......最好的方法是什么?
I want to put on the screen a pseudo-UIAlertView which is just a UIView plus buttons in a nib I've created with IB.... what's the best way of doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Xcode 中创建一个 UIViewController 并让它创建 Xib。在 IB 中添加/编辑控件。然后加载你的视图控制器。将其保留在您创建它的类中,然后将其视图添加为调用类的子视图。像这样:
当您将视图添加到子视图时,除非您设置框架,否则它只会将其添加到视图原点,因此在将其添加到视图层次结构之前也要这样做:
Create a UIViewController in Xcode and have it create the Xib. Add/Edit the controls in IB. Then load your view controller. Retain it in the class where you're creating it and then add its view as a subview of your calling class. Something like:
When you add the view to your subview it will just add it at the view origin unless you set the frame, so do that as well before adding it to the view hirarchy: