{"id":3773,"date":"2014-03-30T05:29:19","date_gmt":"2014-03-30T05:29:19","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/set-button-selector-on-click-event-at-runtime-cocoa-mac-project-collection-of-common-programming-errors\/"},"modified":"2014-03-30T05:29:19","modified_gmt":"2014-03-30T05:29:19","slug":"set-button-selector-on-click-event-at-runtime-cocoa-mac-project-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/set-button-selector-on-click-event-at-runtime-cocoa-mac-project-collection-of-common-programming-errors\/","title":{"rendered":"Set Button selector (on click event) at runtime ? (Cocoa : Mac Project)-Collection of common programming errors"},"content":{"rendered":"<p>Any idea how to set button selector at runtime (on click event) for mac (Not IOS)<\/p>\n<p>I have a view controller with a button declared as outlet :<\/p>\n<pre><code>#import \n\n@interface MyView : NSView\n@property (assign) IBOutlet NSButton *MyBtn;\n<\/code><\/pre>\n<p>i can access that buton with something like this :<\/p>\n<pre><code>MyView * v;\n.\n.\n.\n[v MyBtn]\n<\/code><\/pre>\n<p>i didn&#8217;t find &#8220;addTarget&#8221; choice like on cocoa touch. The only choice is &#8220;setTarget(id)&#8221;<\/p>\n<p>I&#8217;m using Xcode 4.4.1 for osx mountain lion<\/p>\n<p>any suggestion would be appreciated. thanks<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Any idea how to set button selector at runtime (on click event) for mac (Not IOS) I have a view controller with a button declared as outlet : #import @interface MyView : NSView @property (assign) IBOutlet NSButton *MyBtn; i can access that buton with something like this : MyView * v; . . . [v [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3773","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3773"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3773\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}