Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:18:34+00:00 2026-05-25T13:18:34+00:00

I created an ABPersonViewController and added a done button: ABRecordRef rec = ABAddressBookGetPersonWithRecordID(addrBook, recordID);

  • 0

I created an ABPersonViewController and added a done button:

ABRecordRef rec = ABAddressBookGetPersonWithRecordID(addrBook, recordID);
    if (rec) {
        ABPersonViewController* personController = [[[ABPersonViewController alloc] init] autorelease];
        personController.displayedPerson = rec;
        personController.personViewDelegate = self;
        personController.allowsEditing = NO;

        UIBarButtonItem* doneButton = [[[UIBarButtonItem alloc]
                                       initWithBarButtonSystemItem:UIBarButtonSystemItemDone
                                       target: self
                                       action: @selector(dismissModalView:)] autorelease];

        UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:personController] autorelease];
        [self.appViewController presentModalViewController:navController animated: YES];

        // this needs to be AFTER presentModal, if not it does not show up (iOS 4 regression: workaround)
        personController.navigationItem.rightBarButtonItem = doneButton;

I should have been suspicious that it had to be added AFTER the view was presented.

This worked until the app was sent to the background with this view active. When the app was restored the done button was no longer there. I’ve tried many ways to add this Done button but could never get it to remain through an app pause.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:18:34+00:00Added an answer on May 25, 2026 at 1:18 pm

    Here is the solution. Create an empty UIViewController in front of the ABPersonViewController. This will cause the ABPersonViewController to have a back button rather than the created done button. Override ABPersonViewController (DisplayContactViewController below) so you can implement viewDidDisappear. This will be called when the user presses the back button. In viewDidDisappear you can take down the entire navigation stack (including the empty View controller) and get back to your original view.

        DisplayContactViewController* personController = [[[DisplayContactViewController alloc] init] autorelease];  // 
        personController.displayedPerson = rec; // the ABPersonRecord to display
        personController.personViewDelegate = self;
        personController.allowsEditing = NO;
        personController.contactsPlugin = self;  //this is my hook so I can dismiss the picker view later
    
        // create this so DisplayContactViewController will have a "back" button.
        UIViewController* parentController = [[[UIViewController alloc] init] autorelease];
        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:parentController];
    
        [navController pushViewController:personController animated:YES];
    
        [self.appViewController presentModalViewController:navController animated: YES];
    

    Here is DisplayContactViewController viewDidDisappear.

    [super viewDidDisappear: animated];
    [self.contactsPlugin.appViewController dismissModalViewControllerAnimated:NO];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a new SharePoint portal for testing purposes using a manually added HOSTS
Created a button in my aspx file and add its click method in the
created a singleview application with storyboard. Added three viewcontrollers apart from the one view
Created a profile using content provider. After running it correctly, added 3 fields to
I created the following xaml: <Button x:Name=PriceButton> <Button.Template> <ControlTemplate> <Border x:Name=ButtonBorder CornerRadius=2 Background={StaticResource DarkReflectionBrush}
I created a custom component made up of UIView and it gets added as
I created a maven project in eclipse Helios and added hibernate-search 4.0.0.Final and mysql-connector-java
Created a button, now tried to add it to the screen and im getting
i created web project, and added new class library for framework. This framework includes
Created a javascript widget. Had problems with same origin policy. I added the callback

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.