سؤال

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