Ok, I managed to do this. Thanks to all that helped. This is my final decision.
I created a common.m class for some methods that I use in different nibs.
common.h
@interface MetodosGerais : NSObject <UIAlertViewDelegate>{...}
- (void)getUIAlertViewWithDelegate:(id)delegate title:(NSString *)title cancelTitle:(NSString *)cancel;
Common.m
- (void)getUIAlertViewWithDelegate:(id)delegate title:(NSString *)title cancelTitle:(NSString *)cancel {
if (title == @"Enter your Height"){
[[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Atention!", @"Atenção!")
message:@"You Should enter Your Height."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease] show];
}
else if (title == @"Enter your Age"){
[[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Atention!", @"Atenção!")
message:@"You Should enter your Age."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease] show];
}
...
and in my classes that I want to use, I did
Common *myAlert = (Common *)[[UIApplication sharedApplication] delegate];
if ([idade.text length] == 0) {
[myAlert getUIAlertViewWithDelegate:self title:@"Enter Your Age" cancelTitle:@"OK"];
}...
source
share