ios学习笔记UITableViewCell重用时出现重影的解决方案
来源:互联网 发布:红蜘蛛 软件 编辑:程序博客网 时间:2024/06/06 15:35
在UITableView中进行cell 的重用时,偶尔会出现重影的现象
通常我们这样写:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *stee = @"hello"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:stee]; if (cell == nil){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:stee]; cell.accessoryType = UITableViewCellAccessoryNone; } //标题 TitleL=[[UILabel alloc]initWithFrame:CGRectMake(10, 0, 60, cell.contentView.frame.size.height)]; [cell.contentView addSubview:TitleL]; TitleL.text=@"xxx";}
出现重影之后我们可以这样写:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *stee = @"hello"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:stee]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:stee]; cell.accessoryType = UITableViewCellAccessoryNone; //标题 TitleL=[[UILabel alloc]initWithFrame:CGRectMake(10, 0, 60, cell.contentView.frame.size.height)]; TitleL.tag=101; [cell.contentView addSubview:TitleL]; }
UILabel *titleL=(UILabel *)[cell.contentView viewWithTag:101];
titleL.text=@"xxxx";
<span style="font-family: Arial, Helvetica, sans-serif;">}</span>
0 0
- ios学习笔记UITableViewCell重用时出现重影的解决方案
- iOS--UITableViewCell去除重影的方法
- IOS ViewController跳转时出现重影的问题
- UITableViewCell 复用时出现信息错乱
- Fragment出现的重影问题
- ios学习笔记:用xib自定义UITableViewCell的注意事项
- iOS学习笔记-027.UITableViewCell的基本用法
- iOS 自定义tabbar上文字出现重影
- UITableViewCell重影问题
- iOS UITableViewCell的重用机制出现问题解决
- iOS学习笔记1—UITableViewCell设置
- iOS学习笔记—— UITableViewCell 详解
- 黑马程序员-IOS学习笔记-UITableViewCell
- iOS学习笔记:UITableViewcell 嵌套 UIWebView
- ios8 UITableViewCell重用时自定义子视图不更新问题
- 解决uitableviewcell重绘出现重叠的现象
- ios 关于如何消除在向cell中添加图片文字是时出现的重影问题
- IOS学习-UITableViewCell的重用机制原理
- opencv入门01(visual studio2010)--20151229
- 用Fragment制作的Tab页面产生的UI重叠问题
- 解析 CC2541 的 BLE 数据包为什么是 20 字节
- Objective-C对方法进行注释的方法
- 亮仔移植u-boot系列之-- S3c2440在最新版本U-boot-2015.10移植(支持SPL模式启动) -- 3
- ios学习笔记UITableViewCell重用时出现重影的解决方案
- gradle导出依赖的jar包
- 虚函数
- API文档,已取消到该网页的导航
- JSON 数据格式
- 8.2 气泡地图
- 运输层—可靠传输的工作原理
- C#中静态类与非静态类的区别
- synergy在Windows和Linux下使用全攻略(多台PC共享一套键盘鼠标)