Хорошо, мне удалось это сделать. Спасибо всем, что помогло. Это мое окончательное решение
Я создал класс cl.m для некоторых методов, которые я использую в различных перьях.
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];
}
...
и на своих занятиях, которые я хочу использовать, я делал
Common *myAlert = (Common *)[[UIApplication sharedApplication] delegate];
if ([idade.text length] == 0) {
[myAlert getUIAlertViewWithDelegate:self title:@"Enter Your Age" cancelTitle:@"OK"];
}...