Я хочу добавить UITabBar
в мой UIViewController
, я не хочу использовать UITabBarController
, потому что мне нужно нажать этот контроллер вида в контроллер навигации.Как масштабировать изображение TabBarItem
Все в порядке, за исключением того, что мои изображения для UITabBarItem
не являются масштабными, чтобы соответствовать размеру элемента, который будет отображаться правильно.
Как исправить эту проблему?
Вот код:
UITabBar *myTabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0.0, barHeight, screenBounds.size.width, 50.0)];
myTabBar.opaque = YES;
UITabBarItem *barItem1 = [[UITabBarItem alloc] initWithTitle:@"title1" image:[UIImage imageNamed:@"icon1.png"] tag:1];
UITabBarItem *barItem2 = [[UITabBarItem alloc] initWithTitle:@"title2" image:[UIImage imageNamed:@"icon2.png"] tag:2];
UITabBarItem *barItem3 = [[UITabBarItem alloc] initWithTitle:@"title3" image:[UIImage imageNamed:@"icon3.png"] tag:3];
UITabBarItem *barItem4 = [[UITabBarItem alloc] initWithTitle:@"title4" image:[UIImage imageNamed:@"icon4.png"] tag:4];
NSArray *tbItems = [NSArray arrayWithObjects:barItem1, barItem2, barItem3, barItem4, nil];
myTabBar.items = tbItems;