如何确定分配给struct变量的UISlider的标识

时间:2017-06-29 18:36:14

标签: ios swift debugging uislider

我有一个结构存储触及的最后三个UISlider。这些是在另一个类(我的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
   }
}

出于调试目的,我希望能够确定哪些UISliders是lastSlider.current等。 我尝试过简单地打印他们的.debugDescription,但这只会向我提供有关他们的信息,而不是他们的名字。

如何识别UISlider进行调试?

1 个答案:

答案 0 :(得分:0)

正如@crizzis所写:

  

如何使用标签? developer.apple.com/documentation/uikit/uiview/1622493-tag

这解决了我的问题!