objective c - Is assigning the same Action-method to multiple Cocoa UI objects e.g. NSButton possible? -
i'm learning objc , cocoa programming, coming java world. test current skills , learning progress i'm creating small calculator app scratch (osx not ios).
my ui has 10 digit buttons 0-9 among others.
my first thought was, since action receives senders reference, make 1 action -(ibaction)capturedigit:(id)sender
, grab digit button title. interface builder allows action connected 1 sender seems.
so ended creating 10 capturedigit actions in controller.
my question: first option possible somehow? thought of adding actions programmatically (is possible?) buttons, have add digit buttons outlets controller.
bonus question: can nsbutton hold kind of non visible value? not find in documentation. maybe violate mvc pattern ui know of application specific data?
thanks useful , kind answer in advance, i'm still learning
you can connect more more button single action. also, can use tag
field of object give "behind scenes" value.
Comments
Post a Comment