how to get UISwitch in UITableViewCell with text both sides?
How would one get UISwitch in UITableViewCell with text both sides?
Background - I currently have a UITableViewController and when it creates the UITableViewCell I place the UISwitch => accessoryView, and the text (only on left) => textLabel.
So what I want to do is have a UITableViewCell wit开发者_如何学编程h text on both sides of the UISwitch, to use it for a setting: METERS <==> FEET
The best way to achieve what you want is to add the UISwitch
and 2 UILabel
s to the cell's contentView. But I would recommend using a UISegmentedControl
for this type of setting instead.
Or you might try RCSwitch library's custom wide switch. Have a UILabel on the left of the UITableViewCell saying for eg. "Unit" and the wide version of the RCSwitch on the right toggling between the texts Meters and Feet.
精彩评论