简体   繁体   English

如何使用Interface Builder在其他UI元素的背景中添加UIButton?

[英]How to add a UIButton in the background of other UI elements using Interface Builder?

I have to add a UIButton in the background of a View I already layout and position different UI elements on. 我必须在已经布局并放置不同UI元素的View的背景中添加UIButton。 I need to do this to resign first responder when user leave keyboard. 用户离开键盘时,我需要执行此操作以辞退第一响应者。 But this button goes to foreground and I really don't know how to proceed. 但是这个按钮进入了前台,我真的不知道该如何进行。 Any idea ? 任何想法 ?

Thx for helping, 感谢您的帮助,

Stephane 斯蒂芬

UIButton is a subclass of UIview You have a UIView in place now change its class from inspector, and make the style default so it looks like a plain view but with other controls inside it(as it is basically a view ). UIButton是UIview的子类。您现在有一个UIView,可以从检查器中更改其类,并将样式设置为默认,以便它看起来像纯视图,但内部带有其他控件(因为它基本上是view)。 Wire it and use it 连线并使用

Regards, Jackson Sunny Rodrigues 此致,杰克逊·桑尼·罗德里格斯(Jackson Sunny Rodrigues)

I found the solution. 我找到了解决方案。 I just needed to add the button in the top of the UI elements list in the Objects panel. 我只需要在“对象”面板的UI元素列表顶部添加按钮。

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

相关问题 如何使用Interface Builder在UIButton或UIBarButtonItem上添加BgImage? - How to add the BgImage on UIButton or UIBarButtonItem using Interface Builder? 如何重置界面生成器中提到的UIButton背景图像? - how to reset UIButton background image mentioned in interface builder? 当其余的都是通过Interface Builder时,如何使用loadView为选项卡控制器之一添加UI? - How to add the UI for one of the tab controller's using loadView when the rest were via Interface Builder? 界面构建器UIButton自定义背景图像无法在模拟器/设备上运行 - Interface builder UIButton custom background image not working on simulator/device 在Interface Builder(XCode 4)中设置UIButton拉伸背景图像 - Setting UIButton stretched background images in Interface Builder (XCode 4) 访问控制器中Interface Builder中创建的UI元素? - Access UI elements created in Interface Builder in the controller? 使用Interface Builder添加子视图 - Using Interface Builder to add subview 在不使用cocoa中的接口构建器的情况下调用uibutton的动作方法 - call action method for a uibutton without using interface builder in cocoa 在界面生成器中添加UIBarButtonItem,如何? - Add UIBarButtonItem in interface builder, how to? 使用Interface Builder在屏幕外创建UIButton - Create UIButton offscreen with Interface Builder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM