Re: make connections without InterfaceBuilder
Re: make connections without InterfaceBuilder
- Subject: Re: make connections without InterfaceBuilder
- From: Ian Jackson <email@hidden>
- Date: Wed, 10 Feb 2010 00:49:00 +1300
On 9/02/2010, at 5:09 PM, Fritz Anderson wrote:
> On 8 Feb 2010, at 10:03 PM, Jonathan Chacón wrote:
>
>> - (void)awakeFromNib:(id)sender {
>> [boton setTarget:self];
>> [boton setAction:@selector(botonClick:)];
>> }
>
> You mean awakeFromNib (no arguments) not awakeFromNib: (one argument). They name completely different methods, and awakeFromNib is the one the NIB-loading system calls.
>
> — F
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
I'd be interested to hear if you succeed with this. Even with the IBOutlet for the boton declared, there is still nothing to say that you are referring to the button that you have created in IB. For example, in the case where the connections are made by control dragging, you could create two buttons called buttonOne, and buttonTwo.
Then in Xcode, create just one outlet, which would be called ButtonOne. And have an action do [buttonOne setEnabled:NO];
Then, back in IB if you connect ButtonTwo to the AppDelegate (both ways), when you run the app, buttonOne does not respond to clicks (despite the outlet sharing the name), or change when buttonTwo is clicked. However, buttonTwo works when you click it - setting itself to not enabled.
In summary:
[boton setTarget:self];
is only going to work, if the app somehow knows that boton refers to the button which was called boton in IB. setAction: will only work when you already have a connection to the button in IB I believe (this appears to be true in practice).
Ian. _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden