我是新来的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,它不是实现吗?我认为迅速,接口和实现已经合并在一起。 –