TabBar and AddressBook

Discussion in 'iOS Programming' started by patrover, Aug 15, 2009.

  1. patrover macrumors newbie

    Joined:
    Aug 15, 2009
    #1
    hello
    i have a TabBar in my application and i want to load the address book into one of the tabs, i use this:
    Code:
    - (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 :)
     
  2. ritsard macrumors regular

    ritsard

    Joined:
    Jun 18, 2009
    Location:
    SF Bay Area, CA
    #2
    Hmm..that is an interesting question...you can try to use the view for the tab instead of self presentModalViewController. Just a suggestion.
     
  3. drivefast macrumors regular

    Joined:
    Mar 13, 2008
    #3
    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.
     
  4. harry65 macrumors member

    Joined:
    Aug 26, 2008
    #4
    I would think you could change the size of the ABPeoplePickerNavigationController so it will display correctly in your view. Something like this may work:

    Code:
    - (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'.
     
  5. patrover thread starter macrumors newbie

    Joined:
    Aug 15, 2009
  6. brianchris macrumors newbie

    Joined:
    Sep 15, 2009
    #6
    help plz...

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

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #7
  8. brianchris macrumors newbie

    Joined:
    Sep 15, 2009
    #8
    Thank you for the reference

    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
     
  9. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    I'm afraid you misunderstood then because it doesn't say that at all.

    You can present any UIViewController (or subclass thereof) with presentModalViewController. UITabBarController is a subclass of UIViewController. So, I'd say: yes, it is possible.
     
  10. brianchris macrumors newbie

    Joined:
    Sep 15, 2009
    #10
    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.

    Code:
    - (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
     
  11. brianchris macrumors newbie

    Joined:
    Sep 15, 2009
    #11
    i got it done..

    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..
     
  12. abhimoh macrumors newbie

    Joined:
    Aug 24, 2011
    #12
    Same issue

    Hi I am having a very same issue.
    Please advice if someone knows the exact fix.
     
  13. abhimoh macrumors newbie

    Joined:
    Aug 24, 2011
    #13
    AddressBook and Tabbar Controller

    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.
     
  14. drewyboy macrumors 65816

    Joined:
    Jan 27, 2005
    #14
    Sorry to dig up an old thread but this is exactly what I'm looking for but I have no idea how to implement it. What I'm looking for is to have the Contacts TabBar open up contacts and I don't know where to put the code. I've create a new TabBar project for testing. So I've got a clean project but where do I place the code?

    Code:
    - (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];
    }
    So my second tabBar item is the one that should open it. Should I place the code in the secondViewController .m and it should just work? Do I need to do something to app delegate? How do I connect the tabBar icon to "picker"?
     

Share This Page