我们可以在每个屏幕的顶部放置一个静态图像横幅图像吗?
我们的客户认为他们的应用程序中没有足够的品牌,他们希望将他们的徽标放在每个屏幕顶部的横幅中。徽标横幅与导航栏标题的高度大致相同,并且可以只是静态图像。
我们的应用程序有许多不同的屏幕,其中许多由 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以将徽标添加到应用程序的
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 fromMainWindow
).您可以执行此操作 - 查看 XFactor UK 应用程序的示例 ( http://itunes.apple.com/gb/app/the-x-factor-uk/id455682741?mt=8 ) - 导航栏始终带有品牌标识该应用程序。
坏消息是这很难做到 - 我们最终将一个类别应用于
UINavigationBar
来覆盖drawRect
并将背景放在那里,例如: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 overridedrawRect
and putting the background in there e.g.:您可以将横幅徽标保留在 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.
老实说,这不是一个理想的方法,因为正如您所提到的,它并不常见。事实上,苹果可能不会接受取代导航栏等内容的应用程序。
无论如何,如果您必须这样做,您可以将某种横幅视图直接添加到应用程序委托中的窗口中。此后,您必须确保将窗口根视图控制器的框架设置在横幅广告的可见部分下方。从这里开始,其余视图将包含在您指定的框架内,该框架通常是屏幕的大小。
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.