繁体   English   中英

班级不会出现

[英]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);
        }
    }
}

确保您的模块是current - {Your Project}但没有 预期模块

编辑:嗯...这可能不是您遇到的麻烦...如果是这种情况,我将删除此答案。

在整个项目中将其搜索为文本字符串。 它应该显示如下:

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM