0

I am using a uipopover to present a mini number pad to the user when they enter a textfield on my main view controller. when they enter numbers using the number pad, i save the entry into a nsstring property that I've named keypadvalue. there is an unwind segue wired to a done button on the popover which fires the following code.

- (IBAction)doneWithKeyboard:(UIStoryboardSegue *)segue
{
    NSLog(@"unwind");

    if ([segue.sourceViewController isKindOfClass:[KeyPopupViewController class]])
        {
           KeyPopupViewController *popOver2 = segue.sourceViewController;

            activeField.text =popOver2.keypadValue;
        }
}

the activetextfield on my main view controller then gets updated to the kepadvalue, and this all works fine.

my problem now is that i want the activetextfield to update the same way if the user presses outside the uipopover, and it dismisses without firing the unwind segue.

i thought i might use the following to perform the update when the popover dismisses

-(BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
{
    activeField.text = controller.keypadValue;
    return YES;
}

unfortunately despite multiple attempts i can't get the property to return a value it is always null even though the method fires as expected.

how should i recover the property value from the popover using this or another method? i am obviously doing something wrong can anyone advise

thanks

superllanboy
  • 607
  • 2
  • 6
  • 18

1 Answers1

0

It should help:

-(BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
{
    [self.view endEditing:YES];
    activeField.text = controller.keypadValue;
    return YES;
}
Leijonien
  • 1,415
  • 14
  • 16
Sergey Demchenko
  • 2,924
  • 1
  • 24
  • 26