将复选标记放在UITableViewCell的左侧 [英] Put checkmark in the left side of UITableViewCell

查看:106
本文介绍了将复选标记放在UITableViewCell的左侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作类似于WiFi设置页面的内容:当您点击表格单元格时,在单元格的左侧放置一个复选框,并在右侧显示一个公开按钮附件视图以显示更多详细信息。

I want to make something similar to the WiFi settings page: when you tap the table cell, put a checkbox in the left side of the cell, and have a disclosure button accessory view on the right to show more details.

我的问题:有没有办法在不构建自定义UITableViewCell的情况下将复选标记放在UITableViewCell的左侧?

My question: is there a way to put the checkmark in the left side of a UITableViewCell without building a custom UITableViewCell ?

推荐答案

答案是肯定的!您不必为此创建自定义单元格或添加图像视图。要模拟复选框,您只需要为单元格文本添加一个复选框状态的unicode符号。

The answer is YES! You don't have to create a custom cell for that or add image views. To simulate checkboxes you only have to prepend a unicode symbol for a checkbox state to the cell text.

我用于复选框的unicode符号是 \ u2705 for checked和 \\\⬜ for unchecked(几乎与 \ U0001F533 。 iOS将几个 unicode符号作为图标呈现。

The unicode symbols I'm using for checkboxes are \u2705 for checked and \u2B1C for unchecked (nearly the same as \U0001F533 on iOS 5). iOS renders several unicode symbols as icons.

以下是其他一些符号:

@"\u2611", @"\u2B1C", @"\u2705", @"\u26AB", @"\u26AA", @"\u2714", @"\U0001F44D", @"\U0001F44E"






模仿Wi-Fi设置页面( UITableViewCellStyleValue1 ):

cell.textLabel.text = @"\u2001 Wi-Fi 1";
cell.detailTextLabel.text = @"\U0001F512 \u268A";

cell.textLabel.text = @"\u2001 Wi-Fi 2";
cell.detailTextLabel.text = @"\U0001F512 \u268C";

cell.textLabel.text = @"\u2713 Wi-Fi 3";
cell.detailTextLabel.text = @"\U0001F513 \u2630";

这篇关于将复选标记放在UITableViewCell的左侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆