Hmmm.

Okay, thinking out loud here.
I presume that the only significant difference between implementing these 
UIBarButtonItems initially and the remove/re-add sequences is that the view is 
already visible when you re-add them. (I.e., if you 
setTitleTextAttributes:forState: in viewWillAppear:, then the view has not yet 
been drawn…)

I've seen some situations before which seem like they might be analogous. In 
those cases, there was some sort of animation or other asynchronous behavior 
going on. If this is happening in your case, then your 
setTitleTextAttributes:forState: call (on re-adding the UIBarButtonItem) might 
be happening too early.

Support you try this: add the UIBarButtonItem in it's enabled state. Then in a 
dispatch_after (or however you prefer to implement a deferred execution block), 
call setTitleTextAttribute:forState: for the disabled state and then disable 
the control. This idea here is for the text attribute for the disabled state to 
be set after any animations, etc. have completed.

On Jul 10, 2013, at 6:10 PM, Rick Mann <rm...@latencyzero.com> wrote:

> 
> On Jul 10, 2013, at 16:07 , Rick Aurbach <r...@aurbach.com> wrote:
> 
>> Well, since a UIBarButtonItem is a UIBarItem, you might try explicitly using 
>> the UIBarItem method setTitleTextAttributes:forState:, specifying the 
>> disabled state. (You'll need to do this in code (such as viewWillAppear:), 
>> since IB doesn't disclose the information. I'm guessing here, but my guess 
>> is that grayed text is the default text attribute for the disabled state, 
>> unless explicitly overwritten.
> 
> Sorry if I wasn't clear in the original post. This is exactly what I do, and 
> has served me well, until I started removing and re-adding the items to the 
> toolbar so that I could hide them when not applicable.
> 
> -- 
> Rick
> 
> 
> 

Cheers,

Rick Aurbach
Aurbach & Associates, Inc.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to