I have to pass a UITextField value from one view to other views(2nd,3rd...views).Actually in my 3rd ViewController I have a scrollView and I have to display value on it .But UITextField value is not getting passed.It is returning null.Couldn't get what might be wrong? THis is the code I am working with:
But here the id value is not passed to ViewController3.It is returning null ..Where I m going wrong?But here the id value is not passed to ViewController3.It is returning null ..Where I m going wrong?
Code:
Code:
[COLOR=#2B91AF]In[/COLOR] [COLOR=#2B91AF]ViewController1[/COLOR].m:
-([COLOR=#2B91AF]IBAction[/COLOR])butonclick:(id)sender{
[COLOR=#2B91AF]ViewController2[/COLOR] *view2=[[COLOR=#2B91AF]ViewController2[/COLOR] alloc];
view2.id=name.text;
[COLOR=#2B91AF]ViewController3[/COLOR] *view3=[[COLOR=#2B91AF]ViewController3[/COLOR] alloc];
view3.id=name.text;
[view2 release];
[view3 release];
}
IN [COLOR=#2B91AF]ViewConroller2[/COLOR].h :
[COLOR=#800000]@interface[/COLOR] [COLOR=#2B91AF]ViewController2[/COLOR] : [COLOR=#2B91AF]UIViewController[/COLOR] {
[COLOR=#2B91AF]NSString[/COLOR] *id;
[COLOR=#2B91AF]UIlabel[/COLOR] *displayId;
}
[COLOR=#2B91AF]In[/COLOR] [COLOR=#2B91AF]ViewController2[/COLOR].m :
- ([COLOR=#00008B]void[/COLOR])viewDidLoad
{
[COLOR=#00008B]self[/COLOR].displayId.text=[COLOR=#00008B]self[/COLOR].id;
}
[COLOR=#2B91AF]In[/COLOR] [COLOR=#2B91AF]ViewController3[/COLOR].h:
[COLOR=#800000]@interface[/COLOR] [COLOR=#2B91AF]ViewController2[/COLOR] : [COLOR=#2B91AF]UIViewController[/COLOR] {
[COLOR=#2B91AF]NSString[/COLOR] *id;
[COLOR=#2B91AF]UIlabel[/COLOR] *dispId;
}
[COLOR=#2B91AF]In[/COLOR] [COLOR=#2B91AF]ViewController3[/COLOR].m :
- ([COLOR=#00008B]void[/COLOR])viewDidLoad
{
[COLOR=#00008B]self[/COLOR].dispId.text=[COLOR=#00008B]self[/COLOR].id;
}