Search code examples
iphonecocoa-touchios4uibutton

How to send an object as argument when a UIButton is tapped?


I have the following code inside my UIViewController -

[flipButton addTarget:self.navigationController.delegate action:@selector(changeModeAction:) forControlEvents:UIControlEventTouchUpInside];

As you can see, it calls a method inside it's navigation controller delegate. How do I correctly pass along an object to this method?


Solution

  • Or you can use objc_setAssociatedObject and objc_getAssociatedObject