如何确定分配给结构变量的 UISlider 的标识
How to determine the identity of a UISlider assigned to a struct variable
我有一个存储最后三个 UISlider
触摸的结构。这些在另一个class(我的ViewController
)中定义。
这是结构:
struct lastSlider {
var current: UISlider!
var previous: UISlider!
var previousprevious: UISlider!
mutating func setCurrent(slider: UISlider) {
if slider != current {
//push into stack
previousprevious = previous
previous = current
current = slider
}
}
出于调试目的,我希望能够确定哪些 UISlider 是 lastSlider.current
等。
我试过简单地打印他们的 .debugDescription
但这只给我关于他们的信息,而不是他们的名字。
如何识别 UISlider
进行调试?
正如@crizzis 所写:
How about using tags? developer.apple.com/documentation/uikit/uiview/1622493-tag
这解决了我的问题!
我有一个存储最后三个 UISlider
触摸的结构。这些在另一个class(我的ViewController
)中定义。
这是结构:
struct lastSlider {
var current: UISlider!
var previous: UISlider!
var previousprevious: UISlider!
mutating func setCurrent(slider: UISlider) {
if slider != current {
//push into stack
previousprevious = previous
previous = current
current = slider
}
}
出于调试目的,我希望能够确定哪些 UISlider 是 lastSlider.current
等。
我试过简单地打印他们的 .debugDescription
但这只给我关于他们的信息,而不是他们的名字。
如何识别 UISlider
进行调试?
正如@crizzis 所写:
How about using tags? developer.apple.com/documentation/uikit/uiview/1622493-tag
这解决了我的问题!