我是新來的ios開發。UIView方便的初始化器在哪裏
在Xcode中,我可以找到UIView有兩個初始化程序。
@available(iOS 2.0, *)
open class UIView : UIResponder, NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, CALayerDelegate {
open class var layerClass: Swift.AnyClass { get } // default is [CALayer class]. Used when creating the underlying layer for the view.
// default is [CALayer class]. Used when creating the underlying layer for the view.
public init(frame: CGRect)
public init?(coder aDecoder: NSCoder)
......
}
這是我的問題。
in open class,
public init(frame: CGRect)
has no method body?
我認爲只有協議可以有空的實現。在RCTViewManager,我們始終創建無參數
代碼
override func view() -> UIView! {
let ins = CustomUIView()
return ins;
}
一個UIView是這樣方便初始化定義在哪裏?我無法在任何地方找到它。
非常感謝。 xcode跳轉到的文件是UIKit.UIVIEW.swift,它不是實現嗎?我認爲迅速,接口和實現已經合併在一起。 –