开发者

Can we put a static image banner image at the top of every screen?

开发者 https://www.devze.com 2023-04-06 16:55 出处:网络
Our customer decided their application did not have enough branding in it, and they want to put their logo in a banner at the top of every screen.The logo banner is about the same height as the naviga

Our customer decided their application did not have enough branding in it, and they want to put their logo in a banner at the top of every screen. The logo banner is about the same height as the navigation bar header, and can just be a static image.

Our app has many different screens, including many driven by a UINavigationController. We cannot put the logo int开发者_JAVA百科o the "title" portion of the nav controller, because then we do not get to display the title for that view.

Looking at iOS apps, it's clear that this is not common. Has anyone had to do this before, and how did you accomplish it?

Thanks for any tips!


This is not an ideal approach, honestly, because as you mentioned, it isn't very common. Indeed, Apple might not accept apps that displace things such as the navigation bar.

In any case, if you must do this, you can add some sort of banner view directly to your window in the app delegate. After this, you must have sure to set the frame of the window's root view controller to be below the visible portion of the banner ad. From here, the rest of the views will be contained within the frame you specify, which is normally the size of the screen.


You can add the logo to your application's MainWindow and set transparency to all the viewControllers backgrounds. But note that this means that all your viewControllers will share the same background (the one from MainWindow).


You can do this - look at the XFactor UK app for an example ( http://itunes.apple.com/gb/app/the-x-factor-uk/id455682741?mt=8 ) - the navigation bar is branded throughout the app.

The bad news is it's pretty hard to do - we ended up applying a category to UINavigationBar to override drawRect and putting the background in there e.g.:

@implementation UINavigationBar (extras)

- (void)drawRect:(CGRect)rect {

    UIImage *image;

    if (self.frame.size.width>320) {
        image = [UIImage imageNamed: @"NavigationBarWide.png"];
    } else {
        image = [UIImage imageNamed: @"NavigationBar.png"];
    }

    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}


You can keep the banner logo in AppDelegate file and set the frame for BannerLogo. This would be same as displaying ads with iAds or AdMobs. I have done this to display AdMob on all the screen. You need to add BannerLogo as a subView to display on all views.

0

精彩评论

暂无评论...
验证码 换一张
取 消