草庐IT

storyboardName

全部标签

ios - Obj-C 以编程方式更改 ViewController(两个 Storyboard)

首先,我想强调一下,这段代码是有效的,但看起来很糟糕。我需要以编程方式更改ViewController(不能使用segue),所以我使用以下代码:NSString*storyboardName=@"Main";UIStoryboard*storyboard=[UIStoryboardstoryboardWithName:storyboardNamebundle:nil];PurchaseViewController*vc=[storyboardinstantiateViewControllerWithIdentifier:@"PurchaseViewController"];[cont