Bin Chen
Bin Chen

Reputation: 63289

what's wrong with my usage of UINavigationController?

I want to use UINavigationController in my application, my usage is as following:

1) In my root view's .h file I declare a navController by:

UINavigationController *navController;

2) In my root view's .m file, I init the navController by (in viewDidLoad):

navController = [[UINavigationController alloc] initWithRootViewController:self];

3) In my root view's .m file, I add a handler to hander the button click event and in the event handler I try to present another view by:

WBSDKTimelineViewController *controller = [[WBSDKTimelineViewController alloc] initWithAppKey:kWBSDKDemoAppKey appSecret:kWBSDKDemoAppSecret];
[navController pushViewController:controller animated:YES];

After that the view is't presented in the screen, nothing happened, I am sure my code are executed, what's wrong of my usage? Thanks.

Upvotes: 0

Views: 86

Answers (1)

graver
graver

Reputation: 15213

Your root's view controller should be already wrapped within an UINavigationController. Then UIViewController has a property navigationController to access this UINavigationController and push/pop other view controllers to the stack.

Upvotes: 1

Related Questions