且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS7和iOS8的segue.destinationViewController

更新时间:2023-02-03 10:00:42

通过在尝试访问其中一个属性之前检查目标视图控制器的类来解决此问题:

This issue is resolved by checking the class of the destination view controller before trying to access one of its properties:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    DestController *vc = segue.destinationViewController;

    if ([dvc isKindOfClass:[DestController class]])
        dvc.propertyName = @"Property Value";
    else
        // do something else
}

取自主题的解决方案。