View Full Version : TabBar and AddressBook
patrover
Aug 15, 2009, 03:20 PM
hello
i have a TabBar in my application and i want to load the address book into one of the tabs, i use this:
- (void)showPicker {
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controller
picker.peoplePickerDelegate = self;
// showing the picker
[self presentModalViewController:picker animated:NO];
// releasing
[picker release];
}
the problem is that the address book is covering the tab bar , how can i solve this?
thank you :)
ritsard
Aug 15, 2009, 10:51 PM
Hmm..that is an interesting question...you can try to use the view for the tab instead of self presentModalViewController. Just a suggestion.
drivefast
Aug 16, 2009, 11:44 AM
the UITabBar is a UIView, so you can try to bring it to front after you display the address book picker. (i dont know if it works, i never tried it.) but even though, i'm affraid you will be loosing the capability to display the very last row of the address book, as it will show underneath the tab bar. alternatively, take all the entries from the address book and put them in your own table view.
harry65
Aug 16, 2009, 09:14 PM
I would think you could change the size of the ABPeoplePickerNavigationController so it will display correctly in your view. Something like this may work:
- (void)showPicker {
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controller
picker.peoplePickerDelegate = self;
CGRect newFrame = picker.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;
// showing the picker
[self presentModalViewController:picker animated:NO];
// releasing
[picker release];
}
Since the tabBar is 49 pixels (I think, you may want to double check this) you can just subtract that much from the height of your 'picker'.
patrover
Aug 18, 2009, 08:42 AM
thank you so much!
brianchris
Sep 15, 2009, 07:04 AM
I would think you could change the size of the ABPeoplePickerNavigationController so it will display correctly in your view. Something like this may work:
- (void)showPicker {
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
// place the delegate of the picker to the controller
picker.peoplePickerDelegate = self;
CGRect newFrame = picker.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;
// showing the picker
[self presentModalViewController:picker animated:NO];
// releasing
[picker release];
}
Since the tabBar is 49 pixels (I think, you may want to double check this) you can just subtract that much from the height of your 'picker'.
Hey.. what does this 'peoplePickerDelegate' in the following line mean
picker.peoplePickerDelegate = self;
And did this worked out and got the toolbar visible. I still have the problem. But may be because i have not set the delegate. So plz guide me with ur comments as soon as possible....
Thanks in advance,
Brian.
dejo
Sep 15, 2009, 10:42 AM
Hey.. what does this 'peoplePickerDelegate' in the following line mean
picker.peoplePickerDelegate = self;
ABPeoplePickerNavigationController Class Reference (http://developer.apple.com/iphone/library/documentation/addressbookui/reference/ABPeoplePickerNavigationController_Class/Reference/Reference.html)
brianchris
Sep 15, 2009, 12:35 PM
I have gone through it and understood that they are used only if we load the address book into a tab in a tabBarController.
I am not loading an address book. Instead i am calling a presentModalViewController and i am about to perform some actions like bar button edit in this page.
So i would like to know that is there any possibilities to make the tabBar visible in a presentModalViewController where we edit the bar items.
Do help me with your comments..
Thanks,
Brian
dejo
Sep 15, 2009, 12:45 PM
I have gone through it and understood that they are used only if we load the address book into a tab in a tabBarController
I'm afraid you misunderstood then because it doesn't say that at all.
I am not loading an address book. Instead i am calling a presentModalViewController and i am about to perform some actions like bar button edit in this page.
So i would like to know that is there any possibilities to make the tabBar visible in a presentModalViewController where we edit the bar items.
You can present any UIViewController (or subclass thereof) with presentModalViewController. UITabBarController is a subclass of UIViewController. So, I'd say: yes, it is possible.
brianchris
Sep 16, 2009, 01:24 AM
Ya, i am new to this programming. I thought that the peoplePickerDelegate is a built in delegate used for the addressbook functionalities. Sorry for that.
I couldn't make the tab bar visible at all. Could you help me with the codes for making the tab bar visible on a presentModalViewController. It would be more helpful for me.
In the tabBarController, there are 4 bar items in the tab bar. First 3 bar items opens tableviewcontrollers and they are working fine. But the 4th bar item when clicked, opens the presentModalViewController. But it hides the tab bar.
I tried the following code in the 4th bar item's action.
- (void)setEditing:(BOOL)editing animated:(BOOL)animate{
ConfigureSectionScreen *configure = [[ConfigureSectionScreen alloc] init];
[self.tabBarController presentModalViewController:configure animated:YES];
[configure release];
}
I don't know what is the wrong with it. Please guide me with your comments and codes(if possible).
Thanks,
Brian
brianchris
Sep 16, 2009, 06:22 AM
Actually there is no problem with the codings. I was confused with the built in more button that comes while the number of baritems increases. I got it cleared now..
abhimoh
Aug 24, 2011, 04:46 PM
Hi I am having a very same issue.
Please advice if someone knows the exact fix.
abhimoh
Aug 24, 2011, 04:52 PM
Hi, I have a TabBar in my application and i want to load the address book into one of the tabs. the problem is that the address book is covering the tab bar , how can i solve this?
There is a very similar post from 2009, below link - But there is no fix. :-( please advice.
http://forums.macrumors.com/showthread.php?t=766213
Thanks in advance.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.