ios开发之--UITableView中的visibleCells的用法
先上图:

具体代码如下:
#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的用法的更多相关文章
- UITableView中的visibleCells的用法(visibleCells帮上大忙了)
这两天遇到一个问题,UITableView中需要加入动画,而且每一行的速度不一样. 刚开始做时把所有的cell都遍历一遍加上动画,后来发现,如果数据很多时,就会出现各种各样的问题,而且没有显示在界 ...
- 李洪强iOS开发之 - enum与typedef enum的用法
李洪强iOS开发之 - enum与typedef enum的用法 01 - 定义枚举类型 上面我们就在ViewController.h定义了一个枚举类型,枚举类型的值默认是连续的自然数,例如例子中的T ...
- iOS开发系列--UITableView全面解析
--UIKit之UITableView 概述 在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,类似于微信.QQ.新浪微博等软件基本上随处都是U ...
- iOS开发基础-UITableView控件简单介绍
UITableView 继承自 UIScrollView ,用于实现表格数据展示,支持垂直滚动. UITableView 需要一个数据源来显示数据,并向数据源查询一共有多少行数据以及每一行显示什么 ...
- iOS开发:UITableView的优化技巧-异步绘制Cell
最近在微博上看到一个很好的开源项目VVeboTableViewDemo,是关于如何优化UITableView的.加上正好最近也在优化项目中的类似朋友圈功能这块,思考了很多关于UITableView的优 ...
- iOS学习之UITableView中Cell的操作
接着iOS学习之Table View的简单使用 这篇,这里主要讲UITableView 中的Cell的操作,包括标记.移动.删除.插入. 为了简单快捷,直接从原来那篇的代码开始,代码下载地址:http ...
- iOS开发之动画中的时间(概况)
一.引言 在iOS开发中使用动画时,可以通过设置动画的duration.speed.begintime.offset属性,来设置动画的时长.速度.起始时间及起始偏移. 用一个简单的例子来说明各个参数的 ...
- iOS开发总结-UITableView 自定义cell和动态计算cell的高度
UITableView cell自定义头文件:shopCell.h#import <UIKit/UIKit.h>@interface shopCell : UITableViewCell@ ...
- iOS开发之UITableView中计时器的几种实现方式(NSTimer、DispatchSource、CADisplayLink)
最近工作比较忙,但是还是出来更新博客了.今天博客中所涉及的内容并不复杂,都是一些平时常见的一些问题,通过这篇博客算是对UITableView中使用定时器的几种方式进行总结.本篇博客会给出在TableV ...
随机推荐
- Map与实体之间转换
package com.thunisoft.maybee.engine.utils; import java.lang.reflect.Field; import java.lang.reflect. ...
- 定制应用Repeater 、ListView的模版
若干年前有个需求:客户可在管理后台给每个新闻内容栏目指定新闻的显示样式,有的可以显示新闻时间,有的则不需要.于是就有了动态模版的应用.记得当时是用 LoadControl 的方式然后 Controls ...
- Airtest 网易 UI 自动化工具 Airtest 浅用记录
一 使用目的 该工具主要是面向游戏UI测试基于图像识别,如游戏框架unity,Cocos-js以及网易内部的游戏框架同时也支持原生Android App 的基于元素识别的UI自动化测试.本文主要使用目 ...
- (笔记)Linux下的简单CGI编程
为什么要进行CGI编程? 在HTML中,当客户填写了表单,并按下了发送(submit)按钮后,表单的内容被发送到了服务器端,一般的,这时就需要有一个服务器端脚本来对表单的内容进行一些处理,或者是把它 ...
- 第三百七十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—scrapyd部署scrapy项目
第三百七十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—scrapyd部署scrapy项目 scrapyd模块是专门用于部署scrapy项目的,可以部署和管理scrapy项目 下载地址:h ...
- 第三百四十一节,Python分布式爬虫打造搜索引擎Scrapy精讲—编写spiders爬虫文件循环抓取内容—meta属性返回指定值给回调函数—Scrapy内置图片下载器
第三百四十一节,Python分布式爬虫打造搜索引擎Scrapy精讲—编写spiders爬虫文件循环抓取内容—meta属性返回指定值给回调函数—Scrapy内置图片下载器 编写spiders爬虫文件循环 ...
- mysql分页查询语句怎么写?
ref: http://www.dashen100.com/question/500 是用limit函数 取前5条数据 select * from table_name limit 0,5 或者 se ...
- 深入探讨:MySQL数据库MyISAM与InnoDB存储引擎的比较
From: http://www.jb51.net/article/37766.htm MySQL有多种存储引擎,MyISAM和InnoDB是其中常用的两种.这里介绍关于这两种引擎的一些基本概念(非深 ...
- 6.查找单链表中的倒数第k个结点
普通思路:先将整个链表从头到尾遍历一次,计算出链表的长度size,得到链表的长度之后,就好办了,直接输出第(size-k)个节点就可以了(注意链表为空,k 为0,k为1,k大于链表中节点个数时的情况) ...
- ngx-bootstrap学习笔记(一)-popover
前言 这月做了个ng2模块,其中有个校验功能,当校验不通过时给出提示,项目中使用jQuery实现,今天才发现ngx-bootstrap已经有现成功能了,且可封装成通用组件放入shareModule,使 ...