【发布时间】:2015-02-05 23:22:35
【问题描述】:
我对 UIScrollView 进行了子类化以添加一些关于滚动和按钮的功能,而 Xcode 无论如何都无法看到我的子类。
let scrollView = CustomScrollView()
只是给我一个“使用未解析的标识符'CustomScrollView'”错误。我已经清理了项目,重新启动了 Xcode,并且该类肯定已添加到我的项目目标中,所以我不太确定发生了什么。以下是 CustomScrollView 类中的所有代码:
import UIKit
class CustomScrollView: UIScrollView {
override func touchesShouldBegin(touches: NSSet!,
withEvent event: UIEvent!,
inContentView view: UIView!) -> Bool
{
if (view .isKindOfClass(UIButton))
{
return true
}
else
{
return super.touchesShouldCancelInContentView(view)
}
}
}
【问题讨论】:
标签: ios xcode swift uiscrollview