在下面的快速代码中,我收到一个错误:
必须调用超类'UITextView'的指定初始值设定项 方便初始化程序在此处声明(UIKit.UITextView)
这一行:
super.init(frame:frame)
class ACTextField: UITextView, UITextViewDelegate, UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate {
var mDelegate : ACTextFieldDelegate?
var tableViewController : UITableViewController?
var data = [Dictionary<String, AnyObject>]()
@IBInspectable var popoverBackgroundColor : UIColor = UIColor(red: 240.0/255.0, green: 240.0/255.0, blue: 240.0/255.0, alpha: 1.0)
@IBInspectable var popoverSize : CGRect?
@IBInspectable var seperatorColor : UIColor = UIColor(white: 0.95, alpha: 1.0)
init(frame: CGRect) {
super.init(frame: frame)
}
required init(coder aDecoder: NSCoder){
super.init(coder: aDecoder)!
}
}
任何想法如何解决这个问题?
答案 0 :(得分:1)
根据UITextView的文档
// Create a new text view with the specified text container (can be nil) - this is the new designated initializer for this class
@available(iOS 7.0, *)
public init(frame: CGRect, textContainer: NSTextContainer?)