ABPersonPickerNavigationController 和 UITabbarController

发布于 2024-12-06 13:18:04 字数 869 浏览 0 评论 0原文

假设 UITabbarcontroller 的第三个选项卡,我们如何使用 ABPersonPickerNavigationController

实际上,我在此控制器中显示所有地址簿联系人...所以我使用 ABPersonPickerNavigationController

目前我正在使用此代码,但是当我们单击 UITabbarcontroller 的第三个选项卡时...控制器将出现,但我们看不到 UITabbar..

这是我的代码..

-(void)viewWillAppear:(BOOL)animated
{
    // creating the picker
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];

    // place the delegate of the picker to the controll
    picker.peoplePickerDelegate = self;

    // showing the picker
    [self presentModalViewController:picker animated:NO];

    // releasing
    [picker release];   
}

那么我该怎么做才能使 ABPersonPickerNavigationControllerUITabbarcontroller 都可以见过...

请帮我解决这个问题..

提前致谢...

How can we use use ABPersonPickerNavigationController on suppose the third tab of the UITabbarcontroller.

Actually I am showing all Address book contacts in this controller...so I use ABPersonPickerNavigationController

Currently I am using this code but when we click on third tab of UITabbarcontroller.. this controller will present and we can not see that UITabbar..

Here is my code..

-(void)viewWillAppear:(BOOL)animated
{
    // creating the picker
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];

    // place the delegate of the picker to the controll
    picker.peoplePickerDelegate = self;

    // showing the picker
    [self presentModalViewController:picker animated:NO];

    // releasing
    [picker release];   
}

So what can I do so that both the ABPersonPickerNavigationController and UITabbarcontroller can be seen...

Please help me to solve this problem..

Thanks in advance...

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

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

发布评论

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

评论(2

幻梦 2024-12-13 13:18:04

而不是

[self presentModalViewController:picker animated:NO];

尝试这个

[self.navigationController pushViewController:[[picker viewControllers] objectAtIndex:1] animated:NO];

检查您的控制器结构。需要 UINavigationController。

UITabBarController - UINavgationController - UIViewController

但我建议使用 AddressBook Framework 而不是 AddressBookUI 制作自定义人员选择器控制器。

如果不进行定制,您只能更改几个因素。

Instead of

[self presentModalViewController:picker animated:NO];

Try this

[self.navigationController pushViewController:[[picker viewControllers] objectAtIndex:1] animated:NO];

Check your Controller Structure. UINavigationController is needed.

UITabBarController - UINavgationController - UIViewController

But I recommend make custom people picker controller using AddressBook Framework not AddressBookUI.

Without customizing, you can change only a few factor.

可爱暴击 2024-12-13 13:18:04

尝试在应用程序委托中添加一些类似这样的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UITabBarController *tabBar = [[UITabBarController alloc] init];
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
tabBar.viewControllers = [NSArray arrayWithObjects:viewFor1stTab, viewForSecondTab, picker, nil];

[self.window add subview tabBar.view];

将 viewFor1stTab、viewForSecondTab 替换为您想要这些选项卡的视图。
请阅读文档,这可能是UITabBarController最基本的功能。

Try adding some code like this in the app delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UITabBarController *tabBar = [[UITabBarController alloc] init];
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
tabBar.viewControllers = [NSArray arrayWithObjects:viewFor1stTab, viewForSecondTab, picker, nil];

[self.window add subview tabBar.view];

replace viewFor1stTab, viewForSecondTab with the views you want for those tabs.
Please read the documentation, this is probably the most basic function of UITabBarController.

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