Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add image on top of UINavigationController's navigation bar?

I am making an app and was asked to put in a logo over the navigation bar, but also reaching outside the borders of the bar, covering part of my view. This is how it's exactly supposed to be placed (the white circle is the logo).

enter image description here

Due to complicated view controllers structure in this app I want to use UINavigationController, but it seems it could make placing the logo a bit more problematic.

What's a good way to do this? (since obviously putting logo as title image of navigation bar is out of the question due to weird placement)

I was thinking about either making it a subview of keyWindow or of the navigationController.view. Can the first one cause my app to be rejected by Apple?

like image 476
johnyu Avatar asked Nov 15 '13 14:11

johnyu


1 Answers

If you want to add an image from a UIViewController not from a subclass of UINavigationController you can do something like this:

-(void)addImageOnTopOfTheNavigationBar {
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage"]];

   imageView.frame = CGRectMake(....); //set the proper frame here 
   [self.navigationController.view addSubview:imageView];

}
like image 91
danypata Avatar answered Sep 27 '22 15:09

danypata