How to Set Accessibility Identifier in Interface Builder? Xcode4.2

can I set accessibility identifier in interface builder? Xcode4.2

In Xcode 7.1 (ios 9.0) you could do it as simple as possible. Please find the image attached.

Sample Image

You could simply access it as view.accessibilityIdentifier

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.

Sample Image

How do I set the accessibility label for a particular segment of a UISegmentedControl?

I'm just getting started with KIF myself, so I haven't tested this, but it may be worth a try. I'm sure I'll have the same issue soon, so I'd be interested to hear if it works.

First, UIAccessibility Protocol Reference has a note under accessibilityLabel that says:

"If you supply UIImage objects to display in a UISegmentedControl, you can set this property on each image to ensure that the segments are properly accessible."

So, I'm wondering if you could set the accessibilityLabel on each NSString object as well and be able to use that to access each segment with KIF. As a start, you could try creating a couple of strings, setting their accessibility labels, and using [[UISegmentedControl alloc] initWithItems:myStringArray]; to populate it.

Please update us on your progress. I'd like to hear how this goes

How can I verify the name of a label in a table view using Instruments on iOS?

I recommend using tuneup_js. With that library you can easily created test cases and check if the label exists and is equal to My Dogs

You can use it like this

test("LoginCreateEntry", function(target,app){
//Create Entry
//....
var myEntry = target.frontMostApp().mainWindow().scrollViews().staticTexts()["My Dogs!"].name();

//Check is Label is equal to My Dogs
//Test "LoginCreateEntry" will fail if myEntry is not equal to My Dogs
assertEquals(myEntry, "My Dogs");
});

P.S. you should use .name() and not .value() to get the name of the label



Related Topics



Leave a reply



Submit