iOS问题:Segues initiated directly from view controllers must have an identifier

原创文章
声明:作者声明此文章为原创,未经作者同意,请勿转载,若转载,务必注明本站出处,本平台保留追究侵权法律责任的权利。
全栈老韩
全栈工程师,擅长iOS App开发、前端(vue、react、nuxt、小程序&Taro)开发、Flutter、React Native、后端(midwayjs、golang、express、koa)开发、docker容器、seo优化等。

在使用storyboard开发iOS项目时,如果没有设置对应的view controller的identifier时,会有对应的三角警告提醒,只是需要设置一下就好了。

当然如果需要使用storybard的代码跳转判断,是得必须要设置这个identtifier的。

storyboard的警告

在代码中可能有如下的跳转if判断,就可以使用到identifier:

复制代码
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    
    if ([segue.identifier isEqualToString:@"gotoBSCreateTable"]) {
        //self.tableView = [segue destinationViewController];
    }
    
}

暂无评论,快来发表第一条评论吧