开发者

How do I set the accessibility label for a view in xcode4's interface builder?

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";

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.

How do I set the accessibility label for a view in xcode4's interface builder?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜