简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM