Tag: checkbox

不能得到这个checkbox来build立?

我试图解决其他错误,所以它可能看起来有点不同,但这是我能做的最好的。 override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() Box49.setImage(#imageLiteral(resourceName: "UnCheckBox"), for: .normal) Box49.setImage(#imageLiteral(resourceName: "CheckBox"), for: .selected) Box50.setImage(#imageLiteral(resourceName: "UnCheckBox"), for: .normal) Box50.setImage(#imageLiteral(resourceName: "CheckBox"), for: .selected) Box51.setImage(#imageLiteral(resourceName: "UnCheckBox"), for: .normal) Box51.setImage(#imageLiteral(resourceName: "CheckBox"), for: .selected) } @IBAction func Box49(_ sender: UIButton) { sender.isSelected = !(sender as AnyObject).isSelected } @IBAction func Box50(_ sender: UIButton) { sender.isSelected = !(sender as AnyObject).isSelected } […]

通过点击表格视图中的单元格来选中/取消选中该checkbox,以及如何知道哪个单元格已被选中或未选中

我是新来的ios Swift 2.2。 我试图用自定义单元格xib创build一个表视图。 我在我的表格视图中填充一些数据。 而且我还添加了一个自定义checkboxbutton。 我正在为该checkboxbutton创build单独的类。 现在,当我只点击我的customcell.xib中的button。但是当我点击我的单元格时,我的checkbox不会更改。 我需要有两个。 当我点击我的button,它应该改变检查和取消选中图像。 当我点击我的细胞也需要更改我的button来检查或取消选中图像 而当我向下滚动,再次回到顶部时,我检查的图像会自动chnaged到正常检查框。 我需要做一些行动,所以为此。 当我点击任何单元格时,我的checkbox应该检查并取消选中。我需要知道哪一行单元格检查了图像。 所以我可以单独执行我选中的图像行单元格。 这里是我的自定义checkbox类: import UIKit class CheckBoxButton: UIButton { // Images let checkedImage = UIImage(named: "CheckBoxChecked")! as UIImage let uncheckedImage = UIImage(named: "CheckBoxUnChecked")! as UIImage // Bool property var isChecked: Bool = false { didSet{ if isChecked == true { self.setImage(checkedImage, forState: […]

最好的方式来使用checkbox – IOS的​​Swift

我将要开发一个将使用大量checkbox的项目。 我发现像下面这样的解决scheme,但我知道这是不正确的方式。 @IBAction func btn_box(sender: UIButton) { if (btn_box.selected == true) { btn_box.setBackgroundImage(UIImage(named: "box"), forState: UIControlState.Normal) btn_box.selected = false; } else { btn_box.setBackgroundImage(UIImage(named: "checkBox"), forState: UIControlState.Normal) btn_box.selected = true; } } 那么,任何人都可以向我展示在我的项目中有超过20个checkbox的正确方法吗? 我将使用checkbox的forms和设置的目的。 谢谢。

iOS应用程序中的checkbox

我需要添加checkbox控件到我的表单。 我知道在iOS SDK中没有这样的控制。 我怎么能这样做?