【问题标题】:Placing of background image for Tab bar放置标签栏的背景图像
【发布时间】:2016-08-17 09:59:56
【问题描述】:

我在标签栏上放置了背景图片,但问题是第二个项目应该有一个凸起的背景曲线。它在 6s 和 6s Plus 中看起来不错,但在 5s 和 4s 中看起来不好。 [背景图像在 6s 内看起来正常][1] The background image does not look proper in 5s。 如何在 5s 内根据我的需要设置背景图片。我使用了以下图像。 Background Image

【问题讨论】:

  • 这个视图是storyboard的吗?
  • 模拟器截图
  • 如果总黑条是图像,则固定大小。将该图像的 3 大小保留在图像资产 1x、2x、3x 中

标签: ios image background tabbar


【解决方案1】:

仅适用于 iPhone5s 和 4s,正如您所说的 iPhone 6 和 6 Plus 看起来不错。

这是 tabbarBg.png 。大小为 320 * 59。为 iPhone 4s 和 5s 调整图像大小。

将以下代码放入您的 AppDelagate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    if ([[UIScreen mainScreen] bounds].size.width == 320) {

        [[UITabBar appearanceWhenContainedIn:[UIViewController class], nil] setBackgroundImage:[UIImage imageNamed:@"tabbarBg.png"]];
    }
}

【讨论】:

  • 你用的 iPhone5 尺寸是多少?如果可能的话,给我可以自己尝试的背景图片。
  • 我在我的问题中添加了背景图片
  • 请查看编辑。我没有找到其他解决方案。
猜你喜欢
  • 2012-02-13
  • 1970-01-01
  • 2018-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多