Hi guys I'm halfway through implementing a very basic 'Add Contact' Button. I am calling the 'Add View' using the code (via a linked UIButton, that works) :
- (IBAction)showAddContact {
NSLog(@"Hit showAddContact");
ABNewPersonViewController *newPersonViewController = [[ABNewPersonViewController alloc] init];
addContactNavController = [[UINavigationController alloc] initWithRootViewController:newPersonViewController];
[self presentModalViewController:addContactNavController animated:YES];
}
and then I have also set the delegate resonse of:
- (void)newPersonViewController:(ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person {
NSLog(@"Hit newPersonViewController");
//ABContact *contact = [ABContact contactWithRecord:person];
[self.navigationController popViewControllerAnimated:YES];
}
in my header I have set:
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
@interface test2ViewController : UIViewController <ABNewPersonViewControllerDelegate> {
UINavigationController* addContactNavController;
}
- (IBAction)showAddContact;
@end
I have added the frameworks Addressbook and AddressBookUI.
The add dialog box comes up as expected, I can edit the contact, but I am not able to remove the modal View Controller from the view.
I have even duplicated the problem in a simple test project available here:link text
What am I missing?, I bet it is something extremely simple. Thanks @norskben