如何在 xcode4 的界面构建器中为视图设置可访问性标签? [英] How do I set the accessibility label for a view in xcode4's interface builder?

查看:32
本文介绍了如何在 xcode4 的界面构建器中为视图设置可访问性标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用 KIF 为我们的 iphone 应用编写功能测试.它使用可访问性标签"来标识它正在测试的 UI 项目.如何在 xcode4 的界面构建器中为视图设置可访问性标签?

I'm hoping to use KIF to write functional tests for our iphone app. It uses "accessibility labels" to identify the UI items it's testing. How do I set the accessibility label for a view in xcode4's interface builder?

推荐答案

要以编程方式设置变量,您可以像这样使用其属性:

To set the variable programmatically you can use its property like this:

UIButton *someButton = [[UIButton alloc] init];
someButton.titleLabel.text = @"Your Button's Text";
someButton.accessibilityLabel = @"SomeNSString";

<小时>

在 XCode 4 中内置的 InterfaceBuilder 中,您只需选择您想要具有可访问性标签的 UI 项.实用程序"窗格中的身份检查器"提供了一个文本字段,您可以在其中输入所需的任何标签文本.


In the InterfaceBuilder -- built into XCode 4 -- you just have to select the UI item you want to have an accessibility label. The "Identity Inspector", in the "Utility"-pane, offers a textfield where you can enter any label-text you want.

这篇关于如何在 xcode4 的界面构建器中为视图设置可访问性标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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