开发者

how to get UISwitch in UITableViewCell with text both sides?

开发者 https://www.devze.com 2023-04-09 05:07 出处:网络
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

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 UILabels 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号