priya
priya

Reputation: 315

passing the value of a uitextfield from a view to another

I want to pass the value entered in a UITextfield into another view. and this value shud appear in the UItextfield of second view. IBoutlet,propery,synthesize everything is written correctly. still i am not getting the value in the second view. My code, from first view it is passing like this firstview.txtname1.text=name1.text; from second view it is accepting like this player_name1.text=txtname1.text; can anybody tell me where i went wrong?

Upvotes: 0

Views: 434

Answers (1)

Tendulkar
Tendulkar

Reputation: 5540

First you have to declare the property and synthesize in the secondviewcontroller.

in secondview.h

@property(nonatomic,retain) NSString *str;

in secondview.m

@synthesize str;

And then when you are going from first view to second view do like this.

    secondviewobj.name = textfield.text;

Upvotes: 1

Related Questions