我曾经在Objective-c中编程,我用过
UIStoryboard *FILLIN = [UIStoryboard storyboardWithName:@"FILLIN" bundle:nil];
UIViewController *FILLIN = [FILLIN instantiateViewControllerWithIdentifier:@"FILLIN"];
FILLIN.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:FILLIN animated:YES completion:nil];
但那不再适用了。此外,当我尝试使用模态去我想要的视图控制器时,它会混乱并崩溃。我试图从按钮到viewController,我还需要能够去不同的故事板。如果可以的话,我需要知道如何做我的Objective-c代码所做的事情,但是很快。在此先感谢您的帮助!
答案 0 :(得分:1)
假设您的Objective-C代码有效,相关的Swift代码看起来就像
let storyboard = UIStoryboard(name: "FILLIN", bundle: nil)
let viewController = storyboard.instantiateViewControllerWithIdentifier("FILLIN") as UIViewController // Explicit cast is required here.
viewController.modalTransitionStyle = .CoverVertical
self.presentViewController(viewController, animated: true, completion: nil)
您还必须确保文件开头的import UIKit
。