How to use a method with more than one parameters to create custom buttons
- by iphonix
I am repeating my codes few times to create custom buttons, I am trying to create a method and create all my required buttons just by called that method and using two parameters, btnTitle and btnAction.
My Codes for the method
-(void) addnewButton:(NSString *) btnTitle withAction:UIAction btnAction; {
// Add a custom edit navigation button
editButton = [[[UIBarButtonItem alloc]
initWithTitle:NSLocalizedString((btnTitle), @"")
style:UIBarButtonItemStyleBordered
target:self
action:@selector(btnAction)] autorelease];
self.navigationItem.rightBarButtonItem = editButton;
}
Now how shall I call this method to create a button?