先上图:

具体代码如下:

#import "ViewController.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *myTableV;
@property(nonatomic,strong)NSArray *contentAry; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.contentAry = [NSArray array];
[self creatUI];
}
- (IBAction)leftAction:(id)sender {
self.contentAry = self.myTableV.visibleCells;
NSLog(@"----%@",self.contentAry); UIButton *button = (UIButton*)sender;
button.selected = !button.selected;
CGAffineTransform transform;
double duration = 0.1; if (button.tag == ) {
transform = CGAffineTransformMakeTranslation(-[UIScreen mainScreen].bounds.size.width, );
}else if (button.tag == )
{
for (UITableViewCell *cell in self.contentAry) {
[UIView animateWithDuration:duration delay: options: animations:^{
cell.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) { }];
duration += 0.1;
}
return;
}else
{
transform = CGAffineTransformMakeTranslation([UIScreen mainScreen].bounds.size.width, );
} for (UITableViewCell *cell in self.contentAry) {
[UIView animateWithDuration:duration delay: options: animations:^{
cell.transform = transform;
} completion:^(BOOL finished) { }];
duration += 0.1;
} } -(void)creatUI
{
self.myTableV = [[UITableView alloc]initWithFrame:CGRectMake(, , self.view.bounds.size.width, self.view.bounds.size.height - ) style:UITableViewStylePlain];
self.myTableV.delegate = self;
self.myTableV.dataSource = self;
self.myTableV.tableFooterView = [[UIView alloc]init];
[self.view addSubview:self.myTableV];
} -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return ;
} -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *celliden = @"CELLS";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:celliden];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:celliden];
}
cell.textLabel.text = [NSString stringWithFormat:@"%ld",(long)indexPath.row];
cell.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.6];
return cell;
}

仅做记录!

ios开发之--UITableView中的visibleCells的用法的更多相关文章

  1. UITableView中的visibleCells的用法(visibleCells帮上大忙了)

      这两天遇到一个问题,UITableView中需要加入动画,而且每一行的速度不一样. 刚开始做时把所有的cell都遍历一遍加上动画,后来发现,如果数据很多时,就会出现各种各样的问题,而且没有显示在界 ...

  2. 李洪强iOS开发之 - enum与typedef enum的用法

    李洪强iOS开发之 - enum与typedef enum的用法 01 - 定义枚举类型 上面我们就在ViewController.h定义了一个枚举类型,枚举类型的值默认是连续的自然数,例如例子中的T ...

  3. iOS开发系列--UITableView全面解析

    --UIKit之UITableView 概述 在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,类似于微信.QQ.新浪微博等软件基本上随处都是U ...

  4. iOS开发基础-UITableView控件简单介绍

     UITableView 继承自 UIScrollView ,用于实现表格数据展示,支持垂直滚动.  UITableView 需要一个数据源来显示数据,并向数据源查询一共有多少行数据以及每一行显示什么 ...

  5. iOS开发:UITableView的优化技巧-异步绘制Cell

    最近在微博上看到一个很好的开源项目VVeboTableViewDemo,是关于如何优化UITableView的.加上正好最近也在优化项目中的类似朋友圈功能这块,思考了很多关于UITableView的优 ...

  6. iOS学习之UITableView中Cell的操作

    接着iOS学习之Table View的简单使用 这篇,这里主要讲UITableView 中的Cell的操作,包括标记.移动.删除.插入. 为了简单快捷,直接从原来那篇的代码开始,代码下载地址:http ...

  7. iOS开发之动画中的时间(概况)

    一.引言 在iOS开发中使用动画时,可以通过设置动画的duration.speed.begintime.offset属性,来设置动画的时长.速度.起始时间及起始偏移. 用一个简单的例子来说明各个参数的 ...

  8. iOS开发总结-UITableView 自定义cell和动态计算cell的高度

    UITableView cell自定义头文件:shopCell.h#import <UIKit/UIKit.h>@interface shopCell : UITableViewCell@ ...

  9. iOS开发之UITableView中计时器的几种实现方式(NSTimer、DispatchSource、CADisplayLink)

    最近工作比较忙,但是还是出来更新博客了.今天博客中所涉及的内容并不复杂,都是一些平时常见的一些问题,通过这篇博客算是对UITableView中使用定时器的几种方式进行总结.本篇博客会给出在TableV ...

随机推荐

  1. 【jquery】jquery 实现许愿墙效果,可拖拽

    最近整理做过的项目,发现有个许愿墙的效果,今天拿出来给大家分享下. 先简单的介绍下功能点: 随机显示背景图或背景色 出现的位置随机 可以通过拖拽改变位置 好了,附上代码: <!doctype h ...

  2. SpringBoot的文件下载

    SpringBoot的文件下载 2017年11月29日 10:32:20 阅读数:3907 SpringBoot的文件下载方法有很多,此处只记录使用Spring的Resource实现类FileSyst ...

  3. Android 自定义倒计时控件CountdownTextView

    效果如下: 剩余 00:59:21 package com.bihu.advertiserapp.widgets; import android.annotation.TargetApi; impor ...

  4. ViewPager一屏显示多个item,及边缘滑动事件优化

    关于ViewPager显示两边的item方法,网络上是方法都在ViewPager外包一个Layout, 然后设置ViewPager和外面的Layout的clipChildren="false ...

  5. Sublime运行Matlab

    使用Sublime来作为Matlab的编辑器.Sublime编辑+Matlab命令行(terminal)运行的开发环境搭建. 前期准备 Matlab 2014a (Windows或Linux平台,这里 ...

  6. LR中错误代号为27796的一个解决方法

    问题:   曾经遇到过一个问题,在一次性能测试过程中,使用http协议的多用户向服务器发送请求.设置了持续时间,出现错误为:27796, Failed to connect to server 'ho ...

  7. Objective-C MacOS以管理员权限执行程序

    在MacOS下非常多操作是须要管理员权限的, 比方我们执行chmod.在命令行下能够使用sudo chmod来申请以管理员权限执行.可是使用XCode写的程序是不能使用sudo的. 须要自己写代码来申 ...

  8. Linux基础网络设置

    查看Linux网络参数 ifconfig—-查看网络接口 > [root@localhost ~]# ifconfig eth1 Link encap:Ethernet HWaddr 00:0C ...

  9. ASP.NET程序也能像WinForm程序一样运行[转载]

    阅读目录 开始 操作方式 支持的ASP.NET程序类别 它也是个HTTP服务器 支持远程机器访问 不受限于Windows防火墙 尊重每个人的操作习惯 内置多标签浏览器支持 启动参数及配置文件 支持 . ...

  10. 【python】命令行输出颜色

    http://www.cnblogs.com/chjbbs/p/5706513.html