ios - Xcode Property Not Retaining Value -


i have view controller called loginwindowviewcontroller.h declared property called usernametextfield:

@property (strong, nonatomic) iboutlet uitextfield *usernametextfield; 

a string called james associated textfield. import view controller,firstviewcontroller.h loginwindowviewcontroller.m , imported loginwindowviewcontroller.h firstviewcontroller.m . in firstviewcontroller.h there property called username.

@property (strong, nonatomic) iboutlet nsstring *username; 

then assign usernametextfield username(in firstviewcontroller.m). when nslog property username in firstviewcontroller.m, gives null value.how fix this?

when import classes not import values. when set value of property set on instance of class. need explicitly reference property of current instance value have set.

one note: iboutlet stands interface builder outlet , how create link storyboard or xib file ui element class property. so, no need use iboutlet if not linking in interface builder.

string should declared

@property (nonatomic, strong) nsstring *username; 

then when instantiate login view controller first view controller can set property

loginwindowviewcontroller *loginvc = [[loginwindowviewcontroller alloc] init]; [loginvc.usernametextfield settext:self.username]; 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -