How to find a toolbar button

16 views
Skip to first unread message

David Melgar

unread,
May 18, 2011, 4:09:27 PM5/18/11
to UISpec
How do you find a toolbar button with a specific title?

When created through Interface Builder, the following worked,
[app.find.toolbarButton.with accessibilityLabel:@"foo"]

I'm not creating my own buttons, and setting their titles. Finding a
button and doing a "show" does not reveal any property containing its
title. accessibilityLabel doesn't have it. Searches for text, label,
title don't find it.

The button is created as,
[[UIBarButtonItem alloc] initWithTitle:@"foo"
style:UIBarButtonItemStyleBordered ...];

David Melgar

unread,
May 20, 2011, 5:38:53 PM5/20/11
to UISpec
I've solved the problem. After a couple of days of experimentation,
turns out a clean build seems to have fixed the issue.

I'm using XCode 4 and recently switched to LLVM 2.0 as the compiler
for the project. XCode apparently didn't deem the compiler switch
significant enough to rebuild the test project. The test build was
running fine, other than my tests failing by not being able to find
buttons. All properties were coming up with no value,
accessibilityLabel, tag, etc.

After a clean build, its all working. AccessibiltyLabel is set when
programmatically creating the toolbar buttons. I don't understand why
the compiler level should have an impact on its behavior.

Robert Mathews

unread,
May 20, 2011, 5:59:07 PM5/20/11
to uis...@googlegroups.com
On Fri, May 20, 2011 at 5:38 PM, David Melgar <da...@broadreachsoftware.com> wrote:
I've solved the problem. After a couple of days of experimentation,
turns out a clean build seems to have fixed the issue.

I'm using XCode 4 and recently switched to LLVM 2.0 as the compiler
for the project. XCode apparently didn't deem the compiler switch
significant enough to rebuild the test project. The test build was
running fine, other than my tests failing by not being able to find
buttons. All properties were coming up with no value,
accessibilityLabel, tag, etc.

After a clean build, its all working. AccessibiltyLabel is set when
programmatically creating the toolbar buttons. I don't understand why
the compiler level should have an impact on its behavior.

Ouch. My sympathies && thanks for sharing. We've all been there.


 

On May 18, 4:09 pm, David Melgar <da...@broadreachsoftware.com> wrote:
> How do you find a toolbar button with a specific title?
>
> When created through Interface Builder, the following worked,
> [app.find.toolbarButton.with accessibilityLabel:@"foo"]
>
> I'm not creating my own buttons, and setting their titles. Finding a
> button and doing a "show" does not reveal any property containing its
> title. accessibilityLabel doesn't have it. Searches for text, label,
> title don't find it.
>
> The button is created as,
> [[UIBarButtonItem alloc] initWithTitle:@"foo"
> style:UIBarButtonItemStyleBordered ...];

--
You received this message because you are subscribed to the Google Groups "UISpec" group.
To post to this group, send email to uis...@googlegroups.com.
To unsubscribe from this group, send email to uispec+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/uispec?hl=en.


Reply all
Reply to author
Forward
0 new messages