i want to get the username (txtUsername
) from my loginView controller (ViewController
) to SecondViewController
in order to print the message "Welcome Username". I am using Segue (login_success
) between the view controller. In my SecondViewController
I have NSString
(stringUsername
) to store the username from my FirstViewController
. Here is my code in SecondViewController
:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
NSString *segueIdentifier = [segue identifier];
if ([segueIdentifier isEqualToString:@"login_success"]) {
ViewController *homeController = (ViewController *)[segue destinationViewController];
homeController.txtUsername.text = _stringUsername;
}
}
When i set the break point it gives the output as "Printing description of self->_stringUsername: (NSObject) NSObject = "