我试图在用户登录后呈现VC。但是在登录成功后,VC变黑。演示会发生什么here并且有相同的图像。我在stackoverflow上找到了这些文章,但其中任何一篇都没有帮助我。enter image description here
答案 0 :(得分:0)
试试这段代码:
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vc: ALMainController = storyboard.instantiateViewController(withIdentifier: "ALMainController") as! ALMainController
self.present(vc, animated: true, completion: nil)
或者你可以使用它:
let firstPage = self.storyboard?.instantiateViewController(withIdentifier: "ALMainController")as! ALMainController
let appDelegate = UIApplication.shared.delegate
appDelegate?.window??.rootViewController = firstPage
两者都应该有用。
不要忘记写:" ALMainController"到你的故事板Id。
让我知道它是否有效。 :)
答案 1 :(得分:0)
所以问题是你只是初始化ALMainController类。
但是,这不会从Storyboard加载您的视图。有两种方法可以正确地完成并呈现该控制器。
var healthStore = HKHealthStore.new();
And this is how to use HealthKit API in NativeScript. Yes, it is THAT simple.
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "ALMainController")
self.present(controller, animated: true, completion: nil)
希望有所帮助!