所以我试图以编程方式推送到情节提要上的现有视图控制器,但是我得到了使用未声明的类型:LoginViewController,即使我将情节提要ID设置为LoginViewController也是我的代码:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myButton: UIButton!
@IBAction func Button(_ sender: UIButton) {
if let ButtonImage = myButton.image(for: .normal),
let Image = UIImage(named: "ButtonAppuyer.png"),
UIImagePNGRepresentation(ButtonImage) == UIImagePNGRepresentation(Image)
{
let loginVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController
self.navigationController?.pushViewController(loginVC, animated: true)
} else {
print("OK")
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
提前谢谢!