I’ve done a dynamic adding of UIBarButtonItem to UIToolBar and now I’ m trying to implement this as a method -(void)AddBarButton:withTitle (NSString*)title and call it from the event handler (clicking on UISearchBar search results row). The problem is I don’t know how to implement adding UIBarButton as a separate method and the most important how to call it (send)? Who will be the receiver of this message? [self.toolBar addButton] don’t work.
I want to apologise for such may be stupid for professional iOS developers question, because I was a C++\Java programmer for 7 years and now I have to make one iOS project without any experience during short time. So I really need a help.
Thanks in advance!
I’d suggest to add some more parameters to your method to make it more flexible (if you don’t want or need that, you can delete them from the declaration and replace them with fixed values in the method implementation). A sample implementation could look like this:
In your event handler you then call (modify the arguments as needed):