我有2个故事板:MainStoryboard
和LoginStoryboard
。我想在2个故事板上的LoginViewController
中使用委托。当我点击LoginViewController
中的“登录”按钮时,我想呼叫代表并在UIViewController
中显示名为main.storyboard
的特定ProfileViewController
。
这是我的课程:
LoginDelegate.swift
->委托
LoginViewController.swift
->它是LoginStoryboard中的初始vc
HomeViewController.swift
->它是MainStoryboard中的初始vc
ProfileViewController.swift
->这是MainStoryBoard中的vc,接下来我要显示我点击“登录”按钮
你能帮我吗?
答案 0 :(得分:0)
您必须像这样在您的Failed to load https://accounts.google.com/o/oauth2/token: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
中放置一个Storyboard Reference
:
然后,引用您的Login.storyboard
:
答案 1 :(得分:0)
您必须在“登录按钮操作”中调用以下行:
let kMainStoryBoard = UIStoryboard.init(name: "Main", bundle: nil)
if let profileVC = kMainStoryBoard.instantiateViewController(withIdentifier: "your profile VC storyboard identifier") as? ProfileViewController {
let navigation = UINavigationController(rootViewController: profileVC)
self.present(navigation, animated: true, completion: nil)
}