Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lawicko

macrumors member
Original poster
Jul 17, 2008
44
0
Hi again :cool:
For some time I was trying to get rid of 'Cancel' button in UIImagePicker and ABPeoplePickerNavigationController. Even though I previously managed to remove unnecesary stuff from ABPeoplePickerNavigationController, it looks like removing 'Cancel' button is beyond my skills :mad: No matter what I do, the cancel button is displayed on navigation bar. I tried to set RightBarButtonItem (or whatever the name) to nil for appropriate View Controllers (or should I say their Navigation items) but still no effect :( I tried to change that in init method, in viewWillAppear and every other place that may have worked, but it did not.
This is kind of strange, because when I needed to remove Groups view from ABPeoplePickerController, I simply gained access to viewControllers array inside viewWillAppear method, and substituted it with my custom array, and it worked :confused:
Any help is greatly appreciated :rolleyes:
 

kleinemans

macrumors newbie
May 25, 2006
15
0
It might be a little late now but you could try the following:

Code:
picker = [[ABPeoplePickerNavigationController alloc] init];

picker.peoplePickerDelegate = self;
picker.navigationBarHidden=YES;
self.view = picker.view;

This gets rid of the entire navigation bar, including the cancel button. If you place the picker in a navigation view you still have your own navigation bar above it.
 

lawicko

macrumors member
Original poster
Jul 17, 2008
44
0
Thanks for the answer, but I've already found better way to get rid of the buttons. All I had to do is to set a delegate for image or people picker, and implement this method in delegate:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
UIView *custom = [[UIView alloc] initWithFrame:CGRectMake(0,0,0,0)];
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithCustomView:custom];
[viewController.navigationItem setRightBarButtonItem:btn animated:NO];
[btn release];
[custom release];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.