alecnash
alecnash

Reputation: 1768

Customize the Navigation Bar with MonoTouch by adding an image

Is there a way to customize the navigation bar with monoTouch? I am trying to add an imageView to it but unfortunately it doesn't work. Here is my code:

imageView = new UIImageView();
var image = UIImage.FromFile("image.png");
var small = image.Scale (new SizeF (35f, 35f));
imageView.Image = small;
NavigationItem.TitleView = imageView;

Upvotes: 3

Views: 2082

Answers (1)

alecnash
alecnash

Reputation: 1768

I did it. I messed up with passing the image to the view. This is how it works.

var image = UIImage.FromFile("image.png");
var small = image.Scale (new SizeF (35f, 35f));
UIImageView imageView = new UIImageView(small)
NavigationItem.TitleView = imageView;

Upvotes: 9

Related Questions