UILabel文本重叠更新? [英] UILabel text overlapping on update?

查看:215
本文介绍了UILabel文本重叠更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我将文本标签的值从初始值0更改为触摸事件增加。有时,但不是所有的时间,新的值将覆盖在0,这是不冷的。

In my app I change the value of a text label from an initial value of 0 and increment it on a touch event. Sometimes, but not all the time, the new value will be overlayed over the 0, which is not cool..

这是相关的代码:

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
UILabel *label = (UILabel *)[cell viewWithTag:1000];
label.text = qtyString;

我已经尝试从视图中删除标签,然后添加另一个与新的值,没有影响到所有的问题。当我将单元格(标签是表格单元格的一部分)滚出屏幕并返回时,标签会正确显示。哦,我也尝试过

I've tried removing the label from the view, then adding another with the new value, but it didn't affect the problem at all. When I scroll the cell (the labels are part of a table cell) out of the screen and back in, the labels display correctly. Oh, and I've also tried doing

[tableView reloadData];

它效果更好,但如果我选择一个单元格,然后滚动,

And it works better, but if I select a cell and then scroll while it is higlighted it poops out on that cell.

请帮助:(

推荐答案

清除图形上下文为我工作,我不小心取消选择它在第一~~

check the "clears graphics context" works for me, i carelessly deselected it at first~~

这篇关于UILabel文本重叠更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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