滚动后,UiuiseMentedControls在UitableView单元格内重叠
我有一些单元格(设置)。
在单元格内部,我以编程方式创建一个UiseMentedControl:
class SettingsCell: UITableViewCell {
var segDist : UISegmentedControl? = nil ...
var sectionType: SectionType?{
didSet{
guard let sectionType = sectionType else {return}
textLabel?.text = sectionType.description
switch sectionType.containsSegmented{
case .DISTANCE:
if (segDist == nil){
segDist = makeSegmentedControl(items:["yrds","m"], segmentIndex: SettingsManager.shared.getRangeUnitIndex() - 1, action: #selector(handleSegmentedControlActionDistance))}
为每个单元格创建依此类推。一切正常
,但是如果L向下滚动几次(5-10),我的分割controls可以重叠:
似乎在第二行中创建了uisegringedcontrol首先,反之亦然。我该如何避免它?
I have UITableView with some cells (settings).
Inside the cell I create a UISegmentedControl programmatically:
class SettingsCell: UITableViewCell {
var segDist : UISegmentedControl? = nil ...
var sectionType: SectionType?{
didSet{
guard let sectionType = sectionType else {return}
textLabel?.text = sectionType.description
switch sectionType.containsSegmented{
case .DISTANCE:
if (segDist == nil){
segDist = makeSegmentedControl(items:["yrds","m"], segmentIndex: SettingsManager.shared.getRangeUnitIndex() - 1, action: #selector(handleSegmentedControlActionDistance))}
and so on for every cell. Everything works fine
, but if l scroll down and up several times (5-10), my segmentedControls can overlap:
Seems like UISegmentedControl from second row is created in the first and vice versa. How can I avoid it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要该设置中的帮助,请分享您的实施
if you need help in that setup please share your implementation