ios - Semantic Issue with UITextfield -


i'm new ios. i've searched on here uitextfield sematic issues here, variations on that. i'm trying make pretty simple app, you:

enter text text filed press button changes label text entered in text field.

but keep on getting strange sematic error , don't know how fix it.

code here:

the .m file.

#import <uikit/uikit.h>  @interface viewcontroller : uiviewcontroller @property (weak, nonatomic) iboutlet uitextfield *mytextfield;   @property (weak, nonatomic) iboutlet uilabel *mylabel;    - (ibaction)changelabel:(id)sender;  @end 

the .h

#import "viewcontroller.h"  @interface viewcontroller ()   @end @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib. }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (ibaction)changelabel:(id)sender {     nsstring *message = [[nsstring alloc] initwithformat:@"hello %@", [mytextfield text]];     [mylabel settext:message]; } 

thanks.

the problem referencing properties directly without "self.". replace m file contents this:

@interface viewcontroller ()   @end @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib. }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (ibaction)changelabel:(id)sender {     nsstring *message = [[nsstring alloc] initwithformat:@"hello %@", [self.mytextfield text]];     [self.mylabel settext:message]; }  @end 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -