【发布时间】:2016-05-02 19:14:49
【问题描述】:
我正在添加 UITabBar 控制器,但问题是,当我从底部设置背景图像时,它的黑色空间以及当我删除背景图像时,它的工作正常。 我正在添加应用委托
-(void)gotoLoginStoryBoard
{
UIStoryboard *storyboard ;
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *login = [storyboard instantiateInitialViewController];
recentsViewController = [[RecentsViewController alloc]
initWithStyle:UITableViewStylePlain];
recentsViewController.phoneCallDelegate = self;
UINavigationController *recentsViewCtrl = [[[UINavigationController alloc]
initWithRootViewController:
recentsViewController]
autorelease];
recentsViewCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[recentsViewController release];
phoneViewController = [[[PhoneViewController alloc]
initWithNibName:nil bundle:nil] autorelease];
phoneViewController.phoneCallDelegate = self;
ContactViewController *contactsViewCtrl = [[[ContactViewController alloc]
init] autorelease];
contactsViewCtrl.phoneCallDelegate = self;
VoicemailController *voicemailController = [[VoicemailController alloc]
initWithStyle:UITableViewStyleGrouped];
voicemailController.phoneCallDelegate = self;
UINavigationController *voicemailNavCtrl = [[[UINavigationController alloc]
initWithRootViewController:
voicemailController]
autorelease];
voicemailNavCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[voicemailController release];
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:
/*favoritesViewCtrl,*/ login,
phoneViewController, contactsViewCtrl, nil];
tabBarController.selectedIndex = 0;
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbarimage.png"]];
[[[self.tabBarController.viewControllers objectAtIndex:1] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"fill3Copy.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"pathCopy4.png"]];
[[[self.tabBarController.viewControllers objectAtIndex:1] tabBarItem]setTitle:@"Contact"];
[[[self.tabBarController.viewControllers objectAtIndex:2] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"fill3Copy3.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"pathCopy5.png"]];
[[[self.tabBarController.viewControllers objectAtIndex:2] tabBarItem]setTitle:@"Group"];
[[UITabBar appearance] setBackgroundColor:[UIColor blackColor ]];
[self.window setRootViewController:tabBarController];
}
【问题讨论】:
-
你想在哪里设置背景图片以查看控制器背景或 UITabbar 的背景?
-
我正在添加 appdelegate 你可以检查我的代码谢谢
-
当我评论这条线工作正常时 // [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbarimage.png"]];
-
最近控制器数字键盘和联系人的唯一问题没有问题
标签: ios objective-c ios7