您现在的位置是:首页 > 电脑 > 

如何在编辑模式下重新格式化自定义UITableViewCell以适应删除控件?(How to reformat a custom UITableViewCell during editing mode to accommodate Delete controls?)

2025-07-19 10:50:22
如何在编辑模式下重新格式化自定义UITableViewCell以适应删除控件?(How to reformat a custom UITableViewCell during editing mode to accommodate Delete controls?) 我有一个自定义UITableViewCell,其中包含一个UILabel,其中显示了可变数量的文
如何在编辑模式下重新格式化自定义UITableViewCell以适应删除控件?(How to reformat a custom UITableViewCell during editing mode to accommodate Delete controls?)

我有一个自定义UITableViewCell,其中包含一个UILabel,其中显示了可变数量的文本。 动态计算单元格的高度以容纳文本量。

问题是在编辑模式(删除)期间未重新格式化UILabel /文本,如以下屏幕截图所示。

我需要使用自定义单元格而不是标准textLabel等,因为其他行具有更复杂的情况,与多个控件相比,只有一个UILabel。

a)这是具有UILabel控制的表格单元格。 基于文本量动态计算每个单元的高度。

b)当编辑模式启动时,显示编辑控件(红圆圈),将文本从屏幕右侧推出。

c)然后当选择编辑控件并显示删除按钮时,它与文本重叠。

目标是让文本区域(UILabel框架)减小其宽度并增加高度以适应编辑开始“b)”时的所有文本。 当显示删除按钮“c)”时,文本高度将保持不变,并且可以截断不适合的文本并显示省略号“...”。

I have a custom UITableViewCell that contains a UILabel where variable amounts of text are displayed. The height for the cell is dynamically calculated to accomodate the amount of text.

The problem is the UILabel/text is not being reformatted during the Edit mode (Delete) as shown in the following screen captures.

I need to use custom cells rather than the standard textLabel etc. as other rows have more complex situati w/ multiple controls compared to this one w/ just a single UILabel.

a) Here's the table cells w/ the UILabel control. The height of each cell is dynamically calculated based upon the amount of text.

b) When the Edit mode starts the editing control (red circle) is displayed which pushes the text off the right side of the screen.

c) Then when an editing control is selected and the Delete button is displayed it overlaps the text.

The objective is to have the text area (UILabel frame) reduce it's width and increase the height to accommodate all the text when editing starts "b)". When the Delete button is displayed "c)" the text height would stay the same and the text that does not fit can be truncated and an elipsis "..." displayed.

最满意答案

这应该是通过确保您将UILabel添加到UITableViewCell的contentView并且您已在UILabel上正确设置自动调整大小掩码来实现的。 你已经试过了吗?

This should be attainable by making sure that you're adding the UILabel to the contentView of the UITableViewCell and that you've properly set the autoresize masks on the UILabel. Have you already tried that?

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/50284.html

相关标签:无
上传时间: 2023-04-14 14:39:27
留言与评论(共有 15 条评论)
本站网友 胃胀
21分钟前 发表
与多个控件相比
本站网友 张广蕊
18分钟前 发表
因为其他行具有更复杂的情况
本站网友 中央文史馆
0秒前 发表
如以下屏幕截图所示
本站网友 娃哈哈桶装水
24分钟前 发表
动态计算单元格的高度以容纳文本量
本站网友 广州美食店
17分钟前 发表
并且可以截断不适合的文本并显示省略号“...”
本站网友 粉底液
28分钟前 发表
当显示删除按钮“c)”时
本站网友 男篮排名
25分钟前 发表
其中包含一个UILabel
本站网友 中国几个核电站
20分钟前 发表
如何在编辑模式下重新格式化自定义UITableViewCell以适应删除控件?(How to reformat a custom UITableViewCell during editing mode to accommodate Delete controls?) 我有一个自定义UITableViewCell
本站网友 会计城
14分钟前 发表
并且可以截断不适合的文本并显示省略号“...”
本站网友 cs123456
11分钟前 发表
显示编辑控件(红圆圈)
本站网友 二手房交易税费计算器
9分钟前 发表
如何在编辑模式下重新格式化自定义UITableViewCell以适应删除控件?(How to reformat a custom UITableViewCell during editing mode to accommodate Delete controls?) 我有一个自定义UITableViewCell
本站网友 空间申请
6分钟前 发表
并且可以截断不适合的文本并显示省略号“...”
本站网友 药家鑫吧
7分钟前 发表
基于文本量动态计算每个单元的高度
本站网友 骨纤维肉瘤
5分钟前 发表
其中包含一个UILabel