objective c - How to set default text at UITextField in iOS -
following code:
- (void)getage:(nsstring *)age getgender:(nsstring *)gender getlocation:(nsstring *)location getprefage1:(nsstring *)age1 getprefage2:(nsstring *)age2 getprefgender:(nsstring *)prefgender getpreflocation:(nsstring *)preflocation getimage:(uiimage *)image { self.textfieldage.text=age; self.textfieldgender.text=gender; self.textfieldlocation.text=location; self.textfieldprefgender.text=prefgender; self.textfieldprefage1.text=age1; self.textfieldprefage2.text=age2; self.textfieldpreflocation.text=preflocation; self.imageprofilepic.image=image; }
i these value viewcontroller want set these textfields above values. can help? new ios.
this method calling above method :
-(ibaction)editpro:(id)sender { profileeditviewcontroller *profileedit= [[profileeditviewcontroller alloc] initwithnibname:@"profileeditviewcontroller" bundle:nil]; [profileedit getage:_labelage.text getgender:_labelgender.text getlocation:_labellocation.text getprefage1:_labelprefage1.text getprefage2:_labelprefage2.text getprefgender:_labelprefgender.text getpreflocation:_labelpreflocation.text getimage:self.profilepic.image ]; nslog(@"gender :%@",_labelgender.text); [profileedit.saveprofile sethidden:yes]; [self presentviewcontroller:profileedit animated:yes completion:nil]; }
your code should work if:
- text fields hooked in interface builder or correctly initialized programmatically.
- you set properties in main thread.
Comments
Post a Comment