I\'m using storyboard for an iOS application, my storyboard looks like this: http://d.pr/7yAY (droplr url)
The problem is when I click the login button, I send the u
Your segue's destination view controller is your Navigation Controller, not your Events Table View controller.
You can get the Events controller by accessing the Navigation controller's topViewController
property.
Try this:
UINavigationController *navController = (UINavigationController*)[segue destinationViewController];
EventsTableViewController *eventsController = [navController topViewController];
NSString * username = [[NSString alloc] initWithFormat:@"%@", username_tf.text];
[eventsController setUsername:username];
Another thing to verify is that you have properly assigned your destination ViewController as the proper class in Interface Builder. By default this will be UIViewController
or UITableViewController
etc. If you have a custom class with getters/setters, you need to remember to change the class in the Interface Builder
to reflect accordingly, otherwise you will receive an invalid selector error message.
Alternatively, try this:-
(It does the same as jonkroll's answer but in one line and removes the warning "Incompatible pointer types initializing 'ViewController *__strong' with an expression of type UIViewController *
"
NameOfViewController *vc = (NameOfViewController *)[[segue destinationViewController] topViewController];