Add objective-c plugin to swift project
I need help using this custom checkbox:
https://github.com/Marxon13/M13Checkbox
I've already linked the m13checkbox.h and .m classes and wrote the import in the bridge header file, but I don't know how to create checkbox
on mine tableview
and manipulate it ...
I need to place checkbox
in each cell with my own class UITableCell
.
UPD.
I did add checkbox
to cell, but now I need to control it based on my data in UITableViewController
. I need to set checkbox
to checked / unchecked state depending on my dataArray. I also need to set a label for each checkbox
of the dataArray
source to share
In your custom subclass, UITableViewCell
you should declare a property like the following
@IBOutlet weak var checkbox: M13Checkbox!
Then, in the appropriate cell of your storyboard prototype:
- Get the UIView out of the Object Library.
- Change the class of this view to "M13Checkbox" in the Identity inspector.
- Select the checkbox and add any necessary auto-layout constraints.
- In the appropriate lookup table data source, make sure you are decalating the cells with the correct IDs.
When this UITableView is on screen, you should see a checkbox in each cell, assuming your method tableView(_:numberOfRowsInSection:)
returns an integer greater than zero.
source to share