Tôi đã tạo một tabBar
và đặt hình ảnh trong đó, nhưng nó để lại quá nhiều không gian bên dưới tabBarItem
. Làm thế nào tôi có thể loại bỏ điều đó?Làm cách nào để xóa không gian bên dưới UITabBarItem?
Đây là tabBar
tôi hơn hiển thị ngay bây giờ
Và tôi muốn hiển thị nó như thế này
Để hiển thị thanh tabbar
firstVC = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
secondVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
thirdVC = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
forthVC = [[ForthViewController alloc] initWithNibName:@"ForthViewController" bundle:nil];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
NSArray *viewControllersArray = [[NSArray alloc] initWithObjects:firstVC,secondVC,thirdVC,forthVC, nil];
self.tabController = [[UITabBarController alloc] init];
[self.tabController setViewControllers:viewControllersArray animated:NO];
[self.window addSubview:self.tabController.view];
//self.tabController.selectedIndex = 1;
self.tabController.delegate = self;
self.window.rootViewController = self.tabController;
[self.window makeKeyAndVisible];
Đối với hình nền TabBar tôi đã sử dụng mã này
UIImage* tabBarBackground = [UIImage imageNamed:@"tabbarimg1.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
Và đối với thiết lập imge tại mục tôi đã sử dụng mã này
//used to set the tabBarItem images
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"home_tab"] withFinishedUnselectedImage:[UIImage imageNamed:@"home_tab"]];
//Set the badge on tabBarItem
[self.tabBarItem setBadgeValue:@"15"];
thanh tabbar của bạn ở đâu? như bạn đã viết "Đây là thanh tabbar của tôi hơn hiển thị ngay bây giờ" –
Có vấn đề gì khi tôi thêm hình ảnh của mình trong câu hỏi nó hiển thị một số hình ảnh khác như hình ảnh thành phố GTA .... Lạ .... –
Hey @Kane Don Không hiển thị thanh tab của bạn ...... –