Lesson10 - PickerView

效果图

QQ20180324-152330.gif

项目代码地址

加了一个串行队列来更新pickerview

let serial = DispatchQueue(label: "serialQueue1")
        
        serial.async {
            print("A")
            self.pickerView.selectRow(Int(arc4random()) % 10, inComponent: 0, animated: true)
        }
        
        serial.async {
            print("B")
            self.pickerView.selectRow(Int(arc4random()) % 10, inComponent: 1, animated: true)
        }
        
        serial.async {
            print("C")
            self.pickerView.selectRow(Int(arc4random()) % 10, inComponent: 2, animated: true)
//            ASemaphore.wait()
//            BSemaphore.signal()
        }

你可能感兴趣的:(Lesson10 - PickerView)