[英]Class won't show up
我几天前刚刚使这段代码工作,现在给我一个错误:
接口生成器文件中的未知类DraggableImage。
我尝试清理文件,多次重新启动计算机和Xcode,但没有任何效果。 我知道有这样的问题,但他们所说的对我没有任何帮助。 该类也不在下拉菜单中,而是在ViewDidLoad部分中。
我的代码:
class DraggableImage : UIImageView {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.isUserInteractionEnabled = true
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch = touches.first;
let location = touch?.location(in: self.superview);
if location != nil {
self.frame.origin = CGPoint(x: location!.x-self.frame.size.width, y: location!.y-self.frame.size.height);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.