How can I define a method with multiple optional arguments in Obj-C
Posted
by
The Dark Bug Returns
on Stack Overflow
See other posts from Stack Overflow
or by The Dark Bug Returns
Published on 2013-10-24T15:26:52Z
Indexed on
2013/10/24
15:53 UTC
Read the original article
Hit count: 148
objective-c
I want to be able to update two sets of identical buttons with one function. Also I don't want to update all the buttons, only some of them.
Can I have a function like this?:
-(void) updateFields{
updateButton1 : (Bool) x
updateButton2 : (Bool) y
updateButton3 : (Bool) z }
The implementation will look like this:
[button1_1 setEnabled:x];
[button1_2 setEnabled:x]; //called only if updateButton1 is given an argument
[button2_1 setEnabled:y];
etc...
© Stack Overflow or respective owner