我有一个使用单独图像制作的纵向自定义标签栏。问题是,当手机处于横向位置时,图像不够宽,无法制作完整的标签栏。我怎样才能让它看起来没有任何空隙呢?
这是我在纵向视图中实现自定义标签栏的代码:
UIImage *selectedImage0 = [UIImage imageNamed:@"TabImage1DB.png"];
UIImage *selectedImage0 = [UIImage imageNamed:@"TabImage1DB.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"TabImage1LB.png"];
UIImage *selectedImage1 = [UIImage imageNamed:@"TabImage2DB.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"TabImage2LB.png"];
UIImage *selectedImage2 = [UIImage imageNamed:@"TabImage3DB.png"];
UIImage *unselectedImage2 = [UIImage imageNamed:@"TabImage3LB.png"];
UIImage *selectedImage3 = [UIImage imageNamed:@"TabImage4DB.png"];
UIImage *unselectedImage3 = [UIImage imageNamed:@"TabImage4LB.png"];
UIImage *selectedImage4 = [UIImage imageNamed:@"TabImage5DB.png"];
UIImage *unselectedImage4 = [UIImage imageNamed:@"TabImage5LB.png"];
UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
UITabBarItem *item3 = [tabBar.items objectAtIndex:3];
UITabBarItem *item4 = [tabBar.items objectAtIndex:4];
[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
[item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2];
[item3 setFinishedSelectedImage:selectedImage3 withFinishedUnselectedImage:unselectedImage3];
[item4 setFinishedSelectedImage:selectedImage4 withFinishedUnselectedImage:unselectedImage4];