UIButton的选定状态不适用于iOS7 [英] UIButton's Selected State not working in iOS7

查看:143
本文介绍了UIButton的选定状态不适用于iOS7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 5的故事板来创建一个应用程序iOS SDK 7.0。

I am using Xcode 5's storyboarding to create an application, iOS SDK 7.0.

我将一个按钮拖到View上。我希望我的按钮默认显示A。以下是按钮属性:
类型:系统,状态配置:默认,标题:普通

I dragged a button to the View. I want my button to display "A" by Default. Below are the button properties: Type: System, State Config: Default, Title: Plain

我希望我的按钮在选定状态下显示B。因此,更改的按钮属性:
状态配置:已选择

I want my button to display "B" in selected state. So, the button properties that changed: State Config: Selected

在按钮的属性检查器中,在控件下,有一个名为Selected的属性。
如果我检查选中,而不是显示B,它只是突出显示为A上的标记,即没有看到任何字符。

In the Button's Attribute inspector, under the Control, there is a property called Selected. If I check Selected, instead of displaying "B", it just highlights like a marker over A, i.e, no character is seen.

我跑了它在XCODE中。如果未选择按钮,则按预期显示A,但是当我选择按钮而不是显示B时,按钮的文本部分将以浅蓝色突出显示。此外,我从未选择控制下的突出显示内容。

I ran it in XCODE. WHen the button is not selected "A" is displayed as expected but when I select the button, instead of displaying B, the text portion of the button is highlighted with light blue color. Also, I never selected the Highlighted Content under the Control.

如何解决这个问题,以便我能正确显示状态?

How can this be resolved, so that I can display the state correctly?

推荐答案

状态配置设置为选中时,您需要将按钮的标题设置为B。然后,您需要将操作连接到按钮的Touch Up Inside事件。在该操作内部,切换按钮的选择的属性。

当您在属性检查器下选中已选择时,您只是将按钮的初始选择状态设置为YES。 XCode还会显示该按钮在该状态下的样子。

When you check 'Selected' under the Attributes Inspector, you are just setting the button's initial selected state to YES. XCode also shows you what the button would look like in that state.

这篇关于UIButton的选定状态不适用于iOS7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆