I have two text fields, say name and initial in one view controller and I want to display both as one label in another view controller. How can I do this?
To send data from one page to another have a look SO answer here And to Adding/Concatenating two string you have two ways -
assume that this is your first Viewcontroller
this is your UIButton
action for Navigating secondVIewcontroller
- (IBAction)btnSignUp_touchUpInside:(id)sender
{
SignUpViewController *vc=[[SignUpViewController alloc]init]; //addyour secondviewcontroller
vc.strFromUnlinkPage=[NSString stringWithFormat:@"%@. %@",yourinitialtextfield.text,yournametextfirld.text]; // here we concatennating 2 strings
[self.navigationController pushViewController:vc animated:YES];
}
this is your secondVIewcontroller.h
create the one NSString
just like
@interface SignUpViewController : BaseViewController<UITextFieldDelegate, UIAlertViewDelegate>{
}
@property (retain, nonatomic) NSString *strFromUnlinkPage;
@property (retain, nonatomic) IBOutlet UILabel *lblGuide; //assumethat this is your secondviewcontroller `UIlabel` Name
in your .m ViewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
self.lblGuide.text=[NSString stringWithFormat:@"%@", strFromUnlinkPage];
}