路径名称 = 项目名称 + "." + 类名称
例:
let allName = "CAAnimationDemo." + className
let vc = (NSClassFromString(allName) as! UIViewController.Type).init()
vc.title = className
navigationController?.pushViewController(vc, animated: true)
路径名称 = 项目名称 + "." + 类名称
例:
let allName = "CAAnimationDemo." + className
let vc = (NSClassFromString(allName) as! UIViewController.Type).init()
vc.title = className
navigationController?.pushViewController(vc, animated: true)
本文标题:Swift中使用NSClassFromString
本文链接:https://www.haomeiwen.com/subject/fggmhdtx.html
网友评论