Address Book in an Popover - iphone

Does anyone have an example of tell me how I might open up the ABPeoplePickerNavigationController inside a popover. I have the NavigationController that is being used in the popover doing the opening, but it opens up full screen/modal.
Am I missing something here or will I need to write my own people picker to show it in the popover?
Thanks,

Create your UIPopoverController, then add an ABPeoplePickerNavigationController.
ABPeoplePickerNavigationController *contacts = [[ABPeoplePickerNavigationController alloc] init];
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:contacts];

Related

No effect on setViewController:animiated:?

Basically I have
ViewControllerA *aVC = [[ViewControllerA alloc] init];
ViewControllerB *bVC = [[ViewControllerB alloc] init];
UITabBarController *tabBarVC = [[UITabBarController alloc] init];
[tabBarVC setViewControllers:[[NSArray alloc] initWithObjects:aVC, bVC, nil] animated:YES];
Now I can see the two tabs on the tabBarController but when I switch from one tab to another, I can't see any effects, neither on simulator or on real device. From the documentation I should be able to see fading right? Did I miss anything?
If you pass YES to setViewControllers:animated:, UITabBarController will animate the insertion of the the new tab bar items in the tab bar. It doesn't animate the transition between view controllers if the user then switches from one tab to another.

ABPeoplePicker: Reset Custom Navigationbar Appearance

I am using a custom appearance of my UINavigationBar, the UIBarBattunItems and the BackButton. Additionally, I am using Apple's ABPeoplePicker to let the user choose from some contacts. My problem is that I would like to reset the appearance to the default appearance but only while the people picker is presented modally.
Does anyone know how to achieve this?
I am presenting my people picker in the following way.
//showing people picker do identify owner of the certificate
ABPeoplePickerNavigationController* picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
Thanks in advance!
Try adding the following code before the present picker.
picker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
picker.modalPresentationStyle = UIModalPresentationOverCurrentContext;

Directly open ABPersonViewController in EDIT MODE DIRECTLY in iphone

I am developing address book app. When user selects a user from a contact list , I want to open that record directly in EDIT mode using ABPersonViewController instead of clickng Edit button of ABPersonViewController. How can I achieve this? Thanks
Just call setEditing after the view is displayed:
ABPersonViewController *ab = [[ABPersonViewController alloc] init];
ab.allowsEditing = YES;
// customize as you see fit
[self.navigationController pushViewController:ab animated:YES];
[ab setEditing:YES animated:NO];
I tried this on the iPad from within a popover controller and that works fine.
In fact ABNewPersonViewController looks exactly like ABPersonViewController in edit mode.
I accomplished the same by doing like this:
ABRecordID personId = (ABRecordID)contact_ID;// if you want to edit a particular record and you're maintaining contact ID somewhere in your project.
ABPersonViewController *contactVC = [[ABPersonViewController alloc] init];
contactVC.personViewDelegate = self;// set your ViewController as delegate
contactVC.allowsEditing = YES; //set NO if you don't wanna allow editing
contactVC.displayedPerson = ABAddressBookGetPersonWithRecordID(addressBook, personId);
[self.navigationController presentViewController:contactVC animated:YES completion:nil];

How to add a 2nd view as a Tab Bar View (iPhone SDK)

So before I've managed to work with TabBarViewControllers and create an application using them. However every time I do so the view acts as my main view. This time around I want my TabBarView to be my second view in my application
E.g
First window has a bunch of buttons, when I click one of these buttons I want the second view to show up. This view includes a TabBarViewController.
The farthest I've gotten is to have the button show a view but for some reason it won't show my TabBar view!
Here's the code for my button
- (IBAction)showEvents:(id)sender {
EventsViewController *controller = [[EventsViewController alloc] initWithNibName:#"EventsView" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
}
Any of you guys able to help?
Can't you just in the EventsViewController add the following code in viewDidLoad:
UITabBarController *tbc = [[UITabBarController alloc] init];
tbc.viewControllers = [NSArray arrayWithObjects: vc1, vc2, ..., nil];
Anyway, I found a solution and it was actually quite simple. After creating the Outlet for the TabBarController and linking it together with File's Owner all I had to do was add
self.view = tabViewController.view;
On the viewDidLoad method

NavigationController not displayed when used along with TabBarController

In my iphone app, i have a navigation Controller and a tabBar Controller.
The TabBarController has three tabs. In the second and third Tab the NavigationController are added to the viewControllers.
Problem :
In third tab viewController shows the NavigationBar but the in second tab viewController doesnot display navigationBar.
Things I have tried and checked:
1) I checked that all the connections in IB are done properly
2) I checked the size of frame for the view. It doesnot overlap the navigationBar.
3) I also tried using self.navigationController.navigationBar.hidden = NO;
But still it does not show the navigationBar in the second tab.
What should I do?
Please Suggest
Please Help
Thanks!!
We can't do much without looking at your code.
Assuming your TabBarController is properly connected in Interface Builder, you'll need something similar to this:
UIViewController *firstView = [[UIViewController alloc] init];
UIViewController *secondView = [[UIViewController alloc] init];
UIViewController *thirdView = [[UIViewController alloc] init];
UINavigationController *firstNav = [[UINavigationController alloc] initWithRootViewController:secondView];
UINavigationController *secondNav = [[UINavigationController alloc] initWithRootViewController:thirdView];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstView, firstNav, secondNav, nil];
Of course, have every view released afterwards.
Hmmm thats a problem i faced too.
If you look at your IB file ,you'll see that you can do a bit of tweaking and acheive it.
i'll post details as soon as i get time.
Oops!!! a big mistake on my part.I did not check the checkbox for "show navigation bar" in inspector for NavigationController. Hope this helps someone.