我有以下代码,将开关放置在注释标注的左侧附件视图中,但是当我点击它时开关不会改变

let switchDemo = UISwitch()
switchDemo.isOn = true
switchDemo.isEnabled = true;
switchDemo.setOn(true, animated: false)
switchDemo.addTarget(self, action: #selector(switchValueDidChange(_:)), for: .valueChanged)
annotationView.leftCalloutAccessoryView = switchDemo


我想念什么吗?

最佳答案

nvm,您只需将其按住稍长一点即可🙄

09-16 18:44