I want to create a set of buttons that will look like this:
(The selected buttons are those with a different background)
Any ideas for a simple implementation?
Are there any known open source implementations for this?
Thanks!
答案 0 :(得分:1)
For rounded corners use UIButton.layer.cornerRadius
. if you set corner radius to half of the box you will get circle. For the border color use layer.borderColor = UIColor.redColor().CGColor
.
For the background color of the button you can keep track with selected state of the button. Here is an example of using selected state: UIButton state selected
Next thing you could do is to keep data about selected ones, since the best way to do something like this would be UITableView - seems like every row of buttons have same height, and if you want to send that somewhere you can keep track about what items are selected.
答案 1 :(得分:1)
Following is the library which may be use to solve your problem,
For different appearance you need to give the conditional code for that but with out that your problem may solve with this library or code.
You can download the sample code of RRTagController project here.
答案 2 :(得分:0)
I think the best way is to use UICollectionView
.