On Jun 22, 2016, at 4:03 AM, Alastair Houghton wrote:

> On 21 Jun 2016, at 18:54, Alex Zavatone <z...@mac.com> wrote:
> 
>> So, I thought, "well, since I build these UIBarButtonItems from the 
>> UIButtons in the first place, I'll just keep an additional dictionary of 
>> buttons around that then just swap them in and out of an iBOutlet slot in 
>> the storyboard as needed.
>> 
>> Um.  Is this even possible?  Can you assign a UIButton instance that you 
>> have in code to an IBOutlet for a UIButton in the storyboard?   This does 
>> work perfectly for the nav bar's rightButton with barButtonItems, but is 
>> this even possible in code?
>> 
>> I'm missing something here.  Or I'm not.  Any ideas?
> 
> Is the thing that you’re missing that IBOutlets are nothing special; they’re 
> just a property (the syntax “IBOutlet” is there just to tell Xcode which 
> things to show in the GUI editor).  So you can set the property, just the 
> same as you would any other property, from code.  Does that help?

I remember reading the docs that IBAction and IBOutlet are mainly conventions 
for the viewer.

What I am saying is that I DO set the property to be the instance of the button.

And nothing happens.  By that, there is no visual change to the screen.

These buttons are valid 24x24 with graphics, because they display fine with 
used to make a UIBarButtonItem.

I've set the item to redisplay.  Nothing.  

Confusing.  Anyway.  No need to spend time on this now.  I'm using the images 
and it's good enough.  

Thanks.


>> I think I must be a bit dense here, but why not just keep a dictionary of 
>> images and swap the image for the button instead of the button itself?
> 
> That may or may not make more sense, depending.  If the button does something 
> different depending on the state, it might be worth swapping the button (or 
> UIBarButtonItem) instead of just the image, if only because that will help 
> users who are using VoiceOver.  (Hint: when you’re doing this kind of thing, 
> test it with VoiceOver to make sure it’s accessible.)
> 
>> On 21 Jun 2016, at 21:23, Rick Aurbach <r...@aurbach.com> wrote:
>> 
>> I agree that I probably wouldn’t put the images directly in the dictionary 
>> either.
> 
> I don’t see why that would be a problem.  You might want to swap out titles 
> as well, mind.
> 
> Kind regards,
> 
> Alastair.
> 
> --
> http://alastairs-place.net
> 


_______________________________________________

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