How to use a method with more than one parameters to create custom buttons

Posted by iphonix on Stack Overflow See other posts from Stack Overflow or by iphonix
Published on 2010-06-13T16:11:55Z Indexed on 2010/06/13 16:42 UTC
Read the original article Hit count: 207

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode