prepareForSegue for Popover

时间:2015-06-22 22:09:18

标签: ios objective-c

我已经回到了一个项目进行了一些小改动,发现我得到一个NSInvalidArgumentException呈现一个弹出窗口。我几乎可以肯定这在以前是有效的。我正在使用Xcode 6.3.1和iOS 8.3 SDK。

我认为这个问题与发送给prepare UIStoryboardPushSegue的prepareForSegue的segue对象有关 - 如果它是故事板segue中定义的内容,它不应该是UIStoryboardPopoverSegue吗?

我收到的错误是-[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

0 个答案:

没有答案