测试SDWebImage淡入淡出效果在UITableView中的重用显示问题

这个是在上一篇教程的基础上所添加的测试环节!

效果图(从效果图中看是没有任何重用问题的):

源码:

ImageCell.h 与 ImageCell.m

//
// ImageCell.h
// SDWebImageFade
//
// Created by YouXianMing on 14-10-5.
// Copyright (c) 2014年 YouXianMing. All rights reserved.
// #import <UIKit/UIKit.h> @interface ImageCell : UITableViewCell @property (nonatomic, strong) UIImageView *bigImageView; @end
//
// ImageCell.m
// SDWebImageFade
//
// Created by YouXianMing on 14-10-5.
// Copyright (c) 2014年 YouXianMing. All rights reserved.
// #import "ImageCell.h" @implementation ImageCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_bigImageView = [[UIImageView alloc] initWithFrame:CGRectMake(, , , )];
[self addSubview:_bigImageView];
}
return self;
} - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated]; // Configure the view for the selected state
} @end

使用源码:

//
// ViewController.m
// SDWebImageFade
//
// Created by YouXianMing on 14-10-5.
// Copyright (c) 2014年 YouXianMing. All rights reserved.
// #import "ViewController.h"
#import "UIImageView+WebCache.h"
#import "ImageCell.h" @interface ViewController ()<UITableViewDataSource, UITableViewDelegate> @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *dataArray; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; NSLog(@"%@", NSHomeDirectory()); _dataArray = @[@"http://fc04.deviantart.net/fs70/f/2014/277/d/d/swan_song_by_lilyas-d81jjz1.jpg",
@"http://fc08.deviantart.net/fs71/f/2013/103/8/d/8ddafeb73b9e146eef84cc0d45b4fe32-d61mj0f.jpg",
@"http://fc08.deviantart.net/fs70/f/2013/120/8/1/pulsatilla_vulgaris_600_by_lilyas-d63la7p.jpg",
@"http://fc01.deviantart.net/fs71/f/2012/160/c/0/c0690c165b549cc08b006943fcbcb542-d52u5nk.jpg",
@"http://fc03.deviantart.net/fs71/f/2012/199/5/9/5978d4f115b1a70ed0cf6da4dc0cd164-d57qdzg.jpg",
@"http://fc05.deviantart.net/fs70/f/2013/292/c/e/evening_star_by_lilyas-d6r3698.png",
@"http://fc08.deviantart.net/fs70/i/2014/112/6/b/late_night_rose_by_lilyas-d63iu9y.jpg"]; _tableView = [[UITableView alloc] initWithFrame:self.view.bounds
style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_tableView];
} - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_dataArray count];
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *flag = @"YouXianMing";
ImageCell *cell = [tableView dequeueReusableCellWithIdentifier:flag];
if (cell == nil) {
cell = [[ImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:flag];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
} NSString *urlStr = _dataArray[indexPath.row];
[cell.bigImageView setImageWithURL:[NSURL URLWithString:urlStr]
placeholderImage:nil
options:SDWebImageCacheMemoryOnly]; return cell;
} - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return ;
} @end

核心源码地方:

以下是测试的地方:

结论:

不会引起重用问题:)

测试SDWebImage淡入淡出效果在UITableView中的重用显示问题的更多相关文章

  1. jQuery-4.动画篇---淡入淡出效果

    jQuery中淡出动画fadeOut 让元素在页面不可见,常用的办法就是通过设置样式的display:none.除此之外还可以一些类似的办法可以达到这个目的.这里要提一个透明度的方法,设置元素透明度为 ...

  2. 淡入淡出效果的js原生实现

    淡入淡出效果,在日常项目中经常用到,可惜原生JS没有类似的方法,而有时小的页面并不值得引入一个jQuery库,所以就自己写了一个,已封装, 有用得着的朋友, 可以直接使用. 代码中另附有一个设置元素透 ...

  3. Jquery小例子:全选按钮、加事件、挂事件;parent()语法;slideToggle()语法;animate()语法;元素的淡入淡出效果:fadeIn() 、fadeOut()、fadeToggle() 、fadeTo();function(e):e包括事件源和时间数据;append() 方法

    function(e): 事件包括事件源和事件数据,事件源是指是谁触发的这个事件,谁就是事件源(div,按钮,span都可以是事件源),时间数据是指比如点击鼠标的事件中,事件数据就是指点击鼠标的左建或 ...

  4. [转]Android UI:看看Google官方自定义带旋转动画的ImageView-----RotateImageView怎么写(附 图片淡入淡出效果)

    http://blog.csdn.net/yanzi1225627/article/details/22439119 众所周知,想要让ImageView旋转的话,可以用setRotation()让其围 ...

  5. javascript 单个图片的淡入淡出效果和多张图片的淡入淡出效果

    最近刚好在看之前妙趣网站的javascript 初级运动教程,教程里说设置图片的透明度使用了一个变量.这种方法确实不错,但是燕姐喜欢麻烦.就用自己的理解方法写了一遍.其中也是各种坑.现在先把一个图片的 ...

  6. 【jQuery】使用JQ来编写面板的淡入淡出效果

    本文与上一篇的<[jQuery]使用JQ来编写最主要的淡入淡出效果>(点击打开链接)为姊妹篇. 但上一篇仅仅是对文本的基本控制,本篇则是对面板元素进行控制. 尽管功能上很类似,可是所用到的 ...

  7. 【Android Developers Training】 69. 视图切换的淡入淡出效果

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  8. Axure实现淡入淡出效果

    小伙伴们有可能在各大网站看到淡入淡出效果的动画,比如淘宝.京东,淘宝每天会把各种打折促销.今日推荐.限时抢购等做成淡入淡入或者向右活动等类似翻页的效果放在首页,吸引顾客的眼球,那么如何使用Axure来 ...

  9. 使用SDWebImage淡入淡出的方式加载图片

    使用SDWebImage淡入淡出的方式加载图片 效果: 请通过以下方式下载源码: 找到它修改文件的地方: 以下是使用源码: // // ViewController.m // SDWebImageFa ...

随机推荐

  1. [转] Ubuntu 14.04/14.10下安装VMware Workstation 11图文教程

    点击这里查看原文 译者:GuiltyMan 本文由 Linux公社翻译组 原创翻译  Linux公社 诚意奉献 更多请访问此处博客网站 VMware workstation 是一个可以进行桌面操作的虚 ...

  2. 3-nginx.conf参数配置

    –#定义Nginx运行的用户和用户组 –user www www; –#nginx进程数,建议设置为等于CPU总核心数. –worker_processes8; –#全局错误日志定义类型,[ debu ...

  3. Pascal的3种注释

    1.单行注释 {大括号里的内容都被注释掉} 2.单行注释2 //这种注释几乎是绝大部分语言中通用的了 3.多行注释 (*pascal的多行注释有点奇怪,使用的是:括号+星号的方式*)       其他 ...

  4. linux 查找删除找定文件

    find . -name "*.lastUpdated" -exec rm -rf {} \; 这个命令是find的基本用法,可以分两部分,find ~/ -name " ...

  5. fastjson之JSONObject、JSONArray

    JSONObject,JSONArray是JSON的两个子类. 首先我们来看JSONObject源码: 会发现JSONObject是继承Map<String, Object>,并且都是使用 ...

  6. 点击一个元素,触发另一个元素的click事件

  7. C#反射调用外部Dll,执行其中异步函数并取返回值

    using System.Reflection; 1.载入Dll Assembly asm=Assembly.LoadFile(FullPath);//FullPath 为Dll所在位置的全路径. 2 ...

  8. static dictionary methods of text compression

    Now I will introduce a way to compress a text. When we are confronted with numerous data, and the da ...

  9. 深入理解MyBatis的原理(一): 独立的入门demo

    前言:不结合spring,只有 mybatis+maven.数据库使用 oracle.不尝试永远不知道会发生什么事,其中遇到两个小问题,也记录下来了.转载请注明出处:https://www.cnblo ...

  10. java,JsonFormat格式化日期问题

    今天使用以下代码格式日期字段 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; 发现这样渲 ...