|
#1
| ||||
| ||||
| What's an IBAction?
A method that's called as an action from Interface Builder has the signature - (IBAction)actionName: (id)sender. What's an IBAction? Is it an object (an id)? A constant? I don't return anything from these methods, but could I? -Rob
__________________ There are only 10 kinds of people in the world: Those who understand binary, and those who don't. |
|
#2
| ||||
| ||||
| Quote:
__________________ g4 400 AGP - 512 RAM 10GB internal (dumping ground) + 60GB (30 GB OSX partition/30 GB OSX Server partition) - 3GB external SCSI (OS9/and I think the Public Beta is still on there somewhere) - DVD-RAM - ZIP |
|
#3
| ||||
| ||||
|
If I have an IBAction method, will its return value be nil if I do something like this: Code: id obj = [self buttonPressed:self];
__________________ There are only 10 kinds of people in the world: Those who understand binary, and those who don't. |
|
#4
| ||||
| ||||
|
i doubt that'd even compile.. it'll probably say something like 'assigning void value should be ignored.' void isn't nil, it's just nothing. not sure what you're trying to do, but you can differentiate between multiple buttons calling the same action with the tag instance variable - give each button a unique tag value, then do something like Code: -(IBAction)buttonPressed:(id)sender
{
switch ( [sender tag] )
{
case 1:
//blah blah blah
break;
case 2:
//blah blah etc.
break;
}
}
__________________ g4 400 AGP - 512 RAM 10GB internal (dumping ground) + 60GB (30 GB OSX partition/30 GB OSX Server partition) - 3GB external SCSI (OS9/and I think the Public Beta is still on there somewhere) - DVD-RAM - ZIP Last edited by endian; July 25th, 2001 at 04:41 PM. |
|
#5
| ||||
| ||||
|
I was wondering if I could use an IBAction method by invoking a selector at run-time which is a trick I'm trying with the ThreadWorker class (http://iharder.net/macosx/threadworker). I'm away from any NS*-capable compiler for a while, so I can't experiment. -Rob
__________________ There are only 10 kinds of people in the world: Those who understand binary, and those who don't. |
|
#6
| ||||
| ||||
|
you can invoke it at runtime, you just can't return anything. e.g. [window makeKeyAndOrderFront:nil];
__________________ g4 400 AGP - 512 RAM 10GB internal (dumping ground) + 60GB (30 GB OSX partition/30 GB OSX Server partition) - 3GB external SCSI (OS9/and I think the Public Beta is still on there somewhere) - DVD-RAM - ZIP |
|
#7
| ||||
| ||||
|
So I finally got back to my OS X box, and yes, you can set a variable equal to the return value of a method that returns void (or at least, IBAction). Essentially, you're setting the variable to nil. That's not a problem. -Rob
__________________ There are only 10 kinds of people in the world: Those who understand binary, and those who don't. |
![]() |
| Bookmarks |
| Thread Tools | |
|
|