UITabbarController + ABPeoplePickerNavigationController 无法正常工作

发布于 2024-12-07 00:41:05 字数 790 浏览 1 评论 0原文

目前我正在使用 ABPeoplePickerNavigationController 和 UITabbarController 并希望在 UITabbarController 的索引 2 中打开 ABPeoplePickerNavigationController 。

所以在索引 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];
}

但是当我编写此代码时,选项卡栏的标题突然从联系人更改为组和图像未显示..

我们如何像以前一样显示此选项卡栏的标题和图像....

请帮助我解决这个问题..

提前致谢...

Currently I am using ABPeoplePickerNavigationController along with UITabbarController and want to open ABPeoplePickerNavigationController in UITabbarController's index 2..

So on viewcontroller at index 2, I had written code like this,

-(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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

第七度阳光i 2024-12-14 00:41:05

请将此代码写入您的

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

方法中

[self.window addSubview:tabBarController.view];

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

快乐编码....

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....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文