如何由代码跳转其他storyboard中的VC

2025-04-25 18:16:57
推荐回答(1个)
回答1:

1:首先:在custom class中,获取到该VC的名字,这里的是DeviceTableViewController
2:在响应事件里写如下代码:
-(void)btnPressed
{
UIStoryboard *UpgradeHardware = [UIStoryboard storyboardWithName:@"UpgradeHardware" bundle:nil];//UpgradeHardware storyboard的名称
UIViewController *firstVC = [UpgradeHardware instantiateViewControllerWithIdentifier:@"DeviceTableViewController”];//跳转VC的名称
[self.navigationController pushViewController:firstVC animated:YES];
}