Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I override the "Done" button in ABNewPersonViewController
    primarykey
    data
    text
    <p>I have a class that subclasses <code>ABNewPersonViewController</code>. As I understand, when the Done button in the navigation bar is clicked, the delegate method </p> <pre><code>- (void)newPersonViewController:(ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person </code></pre> <p>gets called. But before entering the delegate method, the changes will be saved to address book. </p> <p>What I need is, as soon as the save button gets pressed. I need to load a <code>UIView</code> with 2 buttons asking the user, </p> <ol> <li>whether he wants the changes and</li> <li>whether he should abort the changes made, </li> </ol> <p>But this should be done before the changes are reflected in the address book. And only on the click of the first button in the <code>UIView</code>, that the changes should be saved in the address book. </p> <p>On the click of the 2nd button, the view should disappear and I should return to the view controller class from where the <code>UIView</code> is loaded.</p> <p>My question is, how will I load the view on save button click, before the changes are reflected in the address book</p> <p>I have created a custom save button</p> <pre><code>UIBarButtonItem *okBtn = self.navigationItem.rightBarButtonItem; UIBarButtonItem *saveBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:okBtn.target action:okBtn.action]; self.navigationItem.rightBarButtonItem =saveBtn; [saveBtn release]; </code></pre> <p>On the save button action, the control goes to the delegate method </p> <pre><code> - (void)newPersonViewController:(ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person` . </code></pre> <p>I want the control go to my custom method, where I can load my <code>UIView</code> before the edits are saved in the address book.</p> <p>Edit: When I load the <code>ABNewPersonViewController</code></p> <pre><code> ABPersonViewController *displayVcardViewController = (ABPersonViewController*)[self.navigationController visibleViewController]; ABRecordRef person = displayVcardViewController.displayedPerson; EditAddressNewPersonDetailViewController *newVCardViewController = [[EditAddressNewPersonDetailViewController alloc] init]; newVCardViewController.displayedPerson = person; newVCardViewController.newPersonViewDelegate = self; newVCardViewController.isEditingMode = YES; [self.navigationController setToolbarHidden:YES]; [self.navigationController pushViewController:newVCardViewController animated:YES]; [newVCardViewController release]; </code></pre> <p>Isn't this strong reference already or else Where should I include the strong reference.</p> <p>On </p> <pre><code>- (void)actionSave:(UIBarButtonItem *)sender { if([[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil]) { [self.myView setFrame:CGRectMake(0, 0, 320, 480)]; [[UIApplication sharedApplication].keyWindow addSubview:self.myView]; UIActionSheet * action = [[UIActionSheet alloc]initWithTitle:@"" delegate:self cancelButtonTitle:@"Do" destructiveButtonTitle:@"Cancel" otherButtonTitles: nil]; action.tag = 101; [action showInView:self.view]; [action release]; } } </code></pre> <p>I am loading a <code>UIView</code> with <code>UIAlertView</code> over it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload