简体   繁体   English

UITabbarController + ABPeoplePickerNavigationController无法正常工作

[英]UITabbarController + ABPeoplePickerNavigationController not working properly

Currently I am using ABPeoplePickerNavigationController along with UITabbarController and want to open ABPeoplePickerNavigationController in UITabbarController's index 2.. 目前,我正在将ABPeoplePickerNavigationController和UITabbarController一起使用,并想在UITabbarController的索引2中打开ABPeoplePickerNavigationController。

So on viewcontroller at index 2, I had written code like this, 因此,在索引2的viewcontroller上,我编写了这样的代码,

-(void)awakeFromNib
{
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    NSMutableArray *newControllers = [NSMutableArray arrayWithArray: [self.tabBarController viewControllers]];
    [picker.navigationBar setBarStyle:UIBarStyleBlackOpaque];
    [newControllers replaceObjectAtIndex:2 withObject: picker];
    [self.tabBarController setViewControllers: newControllers animated: NO];
    [picker release];
}

but when I had written this code, suddenly the title of tabbar changed from contacts to Groups and image not showing.. 但是当我编写这段代码时,标签栏的标题突然从联系人更改为组,并且图像未显示。

How can we show the title and image for this tabbar as before.... 我们如何像以前一样显示此标签栏的标题和图像。

Please help me to solve this problem.. 请帮我解决这个问题。

Thanks in advance... 提前致谢...

Please write this code in your 请在您的

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

method after 之后的方法

[self.window addSubview:tabBarController.view];

UITabBarItem *tabItem = [[[self.tabBarController tabBar] items] objectAtIndex:TAB_INDEX];
[tabItem setTitle:@"Contacts"];
tabItem.image = [UIImage imageNamed:@"YOUR IMAGE"];

Happy Coding.... 编码愉快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM