Skip navigation
This discussion is archived

How to hide the Cancel UIBarButtonItem on ABPeoplePickerNavigationControlle

8135 Views 7 Replies Latest reply: Mar 10, 2009 12:49 AM by akandor RSS
aapl.crox Level 1 Level 1 (0 points)
Currently Being Moderated
Sep 1, 2008 9:58 AM
I want to use the ABPeoplePickerNavigationController as tab in my tabbar, not as a modal view but for some reason the controller has hard coded a cancel button on the right of its top bar. Any way to hide it? I have tried subclassing ABPeoplePickerNavigationController and setting the self.navigationItem.rightBarButtonItemto nil, or to a new button, nothing happens. I tried setting self.navigationItem.titleView, nothing happens either.
  • lawicko Calculating status...
    Hi, I had the same problem some time ago. What helped me was overriding
    - (void)navigationController: willShowViewController: animated:

    inside this method you have to create custom IUView with frame rectangle = CGRectMake(0,0,0,0),
    then create custom UIBarButtonItem, init it with custom view (use your previously created UIView), and then replace your rightBarButtonItem for coming ViewController with your new bar button item.

    Btw. Why does it have to be such pain in the *** to go through such a simple tasks?
    Mac Mini, Mac OS X (10.5.4)
  • HoofSC Calculating status...
    Could you suggest how you would put the ABPeoplePickerNavigationController in a tab bar view?

    I keep running into problems using IB. So darn complicated.

    Thanks in advance.
  • HoofSC Level 1 Level 1 (0 points)
    I managed to get the picker in the tab view, but I don't quite follow your steps in the (void)navigationController:willShowViewController:animated:

    ?
  • rgarkov Calculating status...
    Hi HoofSC,

    You are claiming that you've managed to show ABPeoplePickerNavigationController in a tabbar. How did you manage to solve the issue with showing the ABCardViewer after a person is selected. The screen slides into view but only the background is visible. Shows the subviews only after you drag the view up or down with a touch. Some other people in this forum reported the same problem. Can you please help?
    iMac, Mac OS X (10.5.5), iphone OS 2.1
  • MattBrandt Calculating status...
    I did this my making a proxy viewController subclass that does the following in awakeFromNib:


    - (void)awakeFromNib
    {
    ABPeoplePickerNavigationController *nav = [[ABPeoplePickerNavigationController alloc] init];

    NSMutableArray *newControllers = [NSMutableArray arrayWithArray: [self.tabBarController viewControllers]];
    int index = [newControllers indexOfObject: self];

    [newControllers replaceObjectAtIndex: index withObject: nav];

    [self.tabBarController setViewControllers: newControllers animated: NO];
    [nav release];
    }


    This seems to work as expected...

    Matt
    MacBook Pro, Mac OS X (10.5)
  • eaglemay Calculating status...
    @interface PeoplePicker : ABPeoplePickerNavigationController<ABPeoplePickerNavigationControllerDelegate>
    {
    }

    - (void)viewDidLoad
    {
    [super viewDidLoad];
    [self setAllowsCancel : 0];
    [self setAllowsCardEditing: 1];

    self.peoplePickerDelegate = self
    }

    need some more help? let me email...


    Message was edited by: eaglemay

    Message was edited by: eaglemay
    Mac mini, Mac OS X (10.5.4)
  • akandor Calculating status...
    Hi,
    can I use your solution also for my code?

    peoplePicker.navigationBar.tintColor = [UIColor colorWithRed:(102/255.0) green:(102/255.0) blue:(102/255.0) alpha:1.0];

    peoplePicker.title = NSLocalizedString(@"contacts", @"contacts");

    peoplePicker.tabBarItem.image = [UIImage imageNamed:@"buddieIcon.png"];

    peoplePicker.peoplePickerDelegate = self;

    tabBarController.viewControllers = [NSArray arrayWithObjects:favNavController, recNavController, peoplePicker, dialViewController, morNavController, nil];

    ???? Like:

    peoplePicker setAllowsCancel : 0;
    peoplePicker setAllowsCardEditing: 1;

    Thanks for your help!
    iMac 24", Mac Mini, MacBook (white), MacBook (Alu), Mac OS X (10.5.6)

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.