gpt4 book ai didi

swift - uitableview滚动事件步进器交换

转载 作者:行者123 更新时间:2023-11-30 11:54:47 25 4
gpt4 key购买 nike

我有一个桌面 View 和步进器。触摸步进器,移动 TableView 时,随机步进器值会发生变化。我该如何防止它。谢谢

最佳答案

代码

UIViewController

 import UIKit

class ViewController:UIViewController,UITableViewDelegate,UITableViewDataSource{


@IBOutlet weak var tablee: UITableView!
override func viewDidLoad() {
super.viewDidLoad()


}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "test", for: indexPath) as! TesttViewCell

return cell
}
}

TesttViewCell

import UIKit

class TesttViewCell: UITableViewCell {



@IBOutlet weak var adet: UIStepper!
@IBOutlet weak var lblTest: UILabel!

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

@IBAction func changee(_ sender: UIStepper) {
lblTest.text = String(sender.value)
}
}

关于swift - uitableview滚动事件步进器交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47938120/

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