@Artilheiro : If its a navigationbased project, u can create BaseViewController. All other view will inherit this BaseView. In BaseView u can define generic methods to add right button or to change left button text.
ex:
@interface BaseController : UIViewController {
} - (void) setBackButtonCaption:(NSString *)caption;
(void) setRightButtonCaption:(NSString *)caption selectot:(SEL )selector;
@end // In BaseView.M
(void) setBackButtonCaption:(NSString *)caption {
UIBarButtonItem *backButton =[[UIBarButtonItem alloc] init];
backButton.title= caption;
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
} - (void) setRightButtonCaption:(NSString *)caption selectot:(SEL )selector {
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] init];
rightButton.title = caption;
rightButton.target= self;
[rightButton setAction:selector];
self.navigationItem.rightBarButtonItem= rightButton;
[rightButton release];
}
And now in any custom view, implement this base view call the methods:
@interface LoginView : BaseController {
In some method call base method as:
SEL sel= @selector(switchToForgotPIN);
[super setRightButtonCaption:@"Forgot PIN" selectot:sel];