我们可以在每个屏幕的顶部放置一个静态图像横幅图像吗?

发布于 2024-12-05 22:22:57 字数 246 浏览 0 评论 0原文

我们的客户认为他们的应用程序中没有足够的品牌,他们希望将他们的徽标放在每个屏幕顶部的横幅中。徽标横幅与导航栏标题的高度大致相同,并且可以只是静态图像。

我们的应用程序有许多不同的屏幕,其中许多由 UINavigationController 驱动。我们不能将徽标放入导航控制器的“标题”部分,因为这样我们就无法显示该视图的标题。

看看 iOS 应用程序,很明显这并不常见。以前有人必须这样做吗?你是如何完成的?

感谢您的任何提示!

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 into 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

林空鹿饮溪 2024-12-12 22:22:58

您可以将徽标添加到应用程序的 MainWindow 中,并为所有 viewController 背景设置透明度。但请注意,这意味着所有 viewController 将共享相同的背景(来自 MainWindow 的背景)。

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).

戴着白色围巾的女孩 2024-12-12 22:22:58

您可以执行此操作 - 查看 XFactor UK 应用程序的示例 ( http://itunes.apple.com/gb/app/the-x-factor-uk/id455682741?mt=8 ) - 导航栏始终带有品牌标识该应用程序。

坏消息是这很难做到 - 我们最终将一个类别应用于 UINavigationBar 来覆盖 drawRect 并将背景放在那里,例如:

@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 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)];
}
绿萝 2024-12-12 22:22:58

您可以将横幅徽标保留在 AppDelegate 文件中,并为 BannerLogo 设置框架。这与使用 iAds 或 AdMobs 展示广告相同。我这样做是为了在所有屏幕上显示 AdMob。您需要添加 BannerLogo 作为子视图以显示在所有视图上。

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.

惜醉颜 2024-12-12 22:22:57

老实说,这不是一个理想的方法,因为正如您所提到的,它并不常见。事实上,苹果可能不会接受取代导航栏等内容的应用程序。

无论如何,如果您必须这样做,您可以将某种横幅视图直接添加到应用程序委托中的窗口中。此后,您必须确保将窗口根视图控制器的框架设置在横幅广告的可见部分下方。从这里开始,其余视图将包含在您指定的框架内,该框架通常是屏幕的大小。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文