gpt4 book ai didi

ios - 一次可以选择两次的自定义选择器

转载 作者:行者123 更新时间:2023-11-28 10:24:03 26 4
gpt4 key购买 nike

如何在 iOS 中设计此屏幕。

enter image description here

一次可以选择两次,如果可以的话是什么方法?

最佳答案

谢谢@Sudhin Davis,这是个好主意,但最后我决定继续,不对 UI 进行任何更改。我从@Harry 的评论中找到了解决方案。这是我所做的修复工作

let maxV = 25000
override func awakeFromNib() {
self.pickerVIew.delegate = self
self.pickerVIew.dataSource = self
self.pickerViewLoaded(0, component: 0)
self.pickerViewLoaded(0, component: 1)
self.pickerViewLoaded(0, component: 3)
self.pickerViewLoaded(0, component: 4)

}
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int
{
return 6
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
{
if(component == 2 || component == 5)
{
return 2
}
else
{
return maxV
}
}
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String!
{
if(component == 0 || component == 3)
{
return String(format: "%02d", (row%12)+1)
}
else if(component == 1 || component == 4)
{

return String(format: "%02d", (row%12)*5)
}
else
{
return row == 0 ? "AM" : "PM"
}
}
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
self.pickerViewLoaded(row,component: component)
}
func pickerViewLoaded(row:Int,component:Int)
{
var base12 = (maxV/2)-(maxV/2)%12;
self.pickerVIew.selectRow(row%12+base12, inComponent: component, animated: false)
}

关于ios - 一次可以选择两次的自定义选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30165306/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com