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.
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.
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
Swift - Pushviewcontroller from Appdelegate, Rootviewcontroller.Navigationcontroller Is Nil
Using Generic In-App Purchase Items for a Dynamic Range of Digital Products
Attribute Unavailable Warning on iOS Versions Prior to 8.0
Uitableviewcell Height Resize When Image Is Downloaded
What's Currently the "Correct" Way to Set a Uiview's Corner Radius
Afnetworking - Do Not Cache Response
Xcode 6.3.2 Can't Run on Osx 10.11 El Capitan Developer Preview 3
How Big Can the Payload Be When Sending Data via Watchconnectivity
Detect and Use Optional External C Library at Runtime in Objective-C
Google Objective-C API 'Gtl' with Swift
While Mail Sending Process Using iOS 8 Simulators Generates Error
iOS Server Side Validation - Receipt Types
How to Use iOS Speech Recognition in Offline Mode
How to Pop View Controller to One of the Previous View Controllers in Swift
Unrecognized Selector Sent to Instance While Archiving Data (Nscoding)