We're trying to pass information between two views in xcode. We pick up some information in one form and we would to show this information in the next view. We send the information, but we can't receive it in the second view and change the label text with the inforation we send. When we print NSLog(@"%@", campo); in Formulario.m return [UILabel copyWithZone:]: unrecognized selector
ClassCodigo.h:
@property (strong, nonatomic) IBOutlet UITextField *input_codigo;
ClassCodigo.m:
@implementation ClassCodigo
@synthesize input_codigo;
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"pasa_codigo"]) {
Formulario *segundoView = (Formulario *)[segue destinationViewController];
NSLog(@"%@", input_codigo.text); //debug per veure que retorna
segundoView.campo = [input_codigo text];
}
}
Formulario.h:
@property (strong, nonatomic) IBOutlet UILabel *labelCampo;
@property (nonatomic, strong) NSString *campo;
Formulario.m:
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"%@", campo); //debug per veure que retorna
self.labelCampo.text = campo;
}