我创建了一个可可触摸框架,并在一个情节提要项目中使用。 UIView控制器已打开,但出现黑屏,我认为控制器未加载xib。请给我一个我犯错误的解决方案。
import Foundation
import UIKit
public class MyViewController:UIViewController {
// private init(){}
@IBOutlet private weak var statusImage : UIImageView!
@IBOutlet private weak var lblHeading : UILabel!
@IBOutlet private weak var lblMessage : UILabel!
let nibName_myView:String = "MyViewController"
// let veryImportantAttribute: String
public init() {
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override public func viewDidLoad() {
super.viewDidLoad()
print("New Screen")
//..This is working this will change the color on view
self.view.backgroundColor = UIColor.white
}
在我正在使用的Xcode项目中
let initialViewController = MyViewController()
self.present(initialViewController, animated: true, completion: nil)