So I have created a UITabBarController as my root controller, then added UINavigationController as a tab bar item, and a UIViewController as a navigation item for it.

I want to set an image instead of the navigation item title, so I tried the following in viewDidLoad in the UIViewController, but it didn't work:

UIImage *image = [UIImage imageNamed:@"logo.png"];
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:image];

Any Suggestions?

Sorry for my poor English.

有帮助吗?

解决方案

Well guys, I have found out what went wrong!

I should have set the class property for the UIViewController to my custom class controller, that's why viewDidLoad was not being called.

Just follow this tutorial here, and everything should be fine.

http://www.youtube.com/watch?v=LBnPfAtswgw

Now, I want to push another view from the navigation controller?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top