Problem with the Image as a Title in the Navigation Bar

Hi guys, I don't know why my code isn't working! I'm trying to set an Image as the title of the Navigation Bar but it doesn't show nothing. I've tried to set a normal text and it worked but not for the image.
This is the basic code:

UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB (47,47,47);
UINavigationBar.Appearance.TintColor = UIColor.White;
UIImageView imageView = new UIImageView ();
imageView.Image = UIImage.FromBundle ("CasaZeriV");
this.NavigationItem.Title = "hello ios";

Tagged:

Best Answer

Answers

  • RichardSevioraRichardSeviora CAMember

    Is there anything at all visible in the title? When you debug the view controller what do you see?

  • cipriancojcipriancoj ITMember

    If I keep this.NavigationItem.Title = "hello ios"; then the title appears, but if I erase it and I keep only this
    UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB (47,47,47);
    UINavigationBar.Appearance.TintColor = UIColor.White;
    UIImageView imageView = new UIImageView ();
    imageView.Image = UIImage.FromBundle ("ham.png");

    then I can't see nothing in the title part!

    This is the state of the TitleView after I set it

  • cipriancojcipriancoj ITMember

    I forgot the
    NavigationItem.TitleView = imageView;
    Is important the ViewDidLoad() of which ViewController i use the code?

Sign In or Register to comment.