1

我有这张图片UITabBar在此处输入图像描述

这就是我将它添加到选项卡的方式:

[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"NewTabBar.png"]];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabbar_selection.png"]];

而且我注意到,当我将设备旋转到横向模式时,图像不会重新调整到整个屏幕的大小。我怎样才能重新调整它的大小?

4

2 回答 2

1

尝试合并resizableimageWithCapInsets:,如下所示:

[[UITabBar appearance] setSelectionIndicatorImage:[[UIImage imageNamed:@"tabbar_selection.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)]];
于 2013-08-18T14:22:29.167 回答
-2

尝试

self.tabBarController.tabBar.autoresizingMask=UIViewAutoresizingFlexibleRightMargin || UIViewAutoresizingFlexibleLeftMargin;

或者尝试一下;

于 2013-08-18T14:22:37.617 回答