Prepare for Popover

I went back to the project to make some minor changes and found NSInvalidArgumentException

myself getting a message representing a popover. I'm pretty sure this worked before. I am using Xcode 6.3.1 and iOS 8.3 SDK.

I suppose the problem is with the segue object being sent to prepareForSegue, which is UIStoryboardPushSegue

, if it is not UIStoryboardPopoverSegue

, if this is what is defined in the segue of the storyboard?

The error I am getting is this -[UIStoryboardPushSegue popoverController]: unrecognized selector sent to instance

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        DatePickerViewController *vc = (DatePickerViewController*)segue.destinationViewController;
        [vc setQuestion:self.question];
        [vc setDismissPopoverDelegate:self];

        if([segue.identifier isEqualToString:@"CompletionDateSegue"])
        {
            [vc.datePicker setDate:self.question.completionDate animated:YES];
            [vc setPropertyName:@"completionDate"];

        }
        else if ([segue.identifier isEqualToString:@"TargetCompletionDateSegue"])
        {
            [vc.datePicker setDate:self.question.targetCompletionDate animated:YES];
            [vc setPropertyName:@"targetCompletionDate"];
        }

        UIStoryboardPopoverSegue *popoverSegue = (UIStoryboardPopoverSegue *)segue;
        [popoverSegue.popoverController setPopoverContentSize:CGSizeMake(320, 256) animated:YES];
}

      

Storyboard

+3


source to share





All Articles