开发者

ABPersonPickerNavigationController and UITabbarController

开发者 https://www.devze.com 2023-04-08 11:05 出处:网络
How can we use use ABPersonPickerNavigationController on suppose the third tab of the UITabbarcontroller.

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号