简体   繁体   English

在界面构建器/故事板中设置UIButton图像

[英]Set UIButton image in interface builder / storyboard

I have a View Controller which I add a round rect button to in storyboard. 我有一个View Controller,我在故事板中添加了一个圆形的矩形按钮。 The application is working well and I also connected the button to a segue using the storyboard. 该应用程序运行良好,我还使用故事板将按钮连接到segue。 I am trying to set a custom image for this button for it on&off states. 我正在尝试为此按钮设置自定义图像,以便打开和关闭状态。 How do i access this button and set it's properties? 如何访问此按钮并设置其属性? (in this case the on & off images) (在这种情况下,开关图像)

Here is a screenshot : 这是一个截图:

的UIButton

Set your button type to Custom, and change the image for all the states (choose a state, then choose the image, repeat for each state). 将按钮类型设置为自定义,并更改所有状态的图像(选择状态,然后选择图像,对每个状态重复)。

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

相关问题 通过代码设置在Interface Builder中创建的UIButton的图像 - Set Image of UIButton Created in Interface Builder, by code 如何在 XCode Interface Builder 中设置 UIButton 的选定图像 - How to set selected image of UIButton in XCode Interface Builder 在 Storyboard 中为 UIButton 设置边框 - Set a border for UIButton in Storyboard 在Interface Builder中设置UIButton图层边框宽度和颜色 - Set UIButton Layer Border Width and Color in Interface Builder 如何在界面生成器 (Xcode 9) 中工作的 UIButton 子类中设置默认标题 - How to set a default title in UIButton subclass that works in Interface Builder (Xcode 9) 在应用程序中忽略在Interface Builder中设置为UIButton的归属标题属性 - Attributed Title attributes set to UIButton in Interface Builder are ignored in app UIButton图像不随Interface Builder设置更改(已选中和禁用) - UIButton Image Not Changing With Interface Builder Settings (Selected & Disabled) Tint UIButton的界面构建器中的图像与UIImageRenderingModeAlwaysTemplate - Tint UIButton's image from interface builder with UIImageRenderingModeAlwaysTemplate 如何在Interface Builder中更改UIButton的背景图像并保持其形状? - How to change background image of the UIButton in Interface Builder and preserve its shape? iOS - 界面生成器:设置图像时 UIButton 标题消失 - iOS - Interface Builder: UIButton title disappears when setting image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM