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 ...
随机推荐
- SpringMVC深度探险(二) —— SpringMVC概览
对于任何事物的研究,总是由表及里.由浅入深地进行.在本系列的第二篇文章中,我们将通过不同的观察视角,对SpringMVC做一些概要性的分析,帮助大家了解SpringMVC的基本构成要素.SpringM ...
- Linux 客户端bind函数的使用
无连接的socket的客户端和服务端以及面向连接socket的服务端通过调用bind函数来配置本地信息. 使用bind函数时,通过将my_addr.sin_port置为0,函数会自动为你选择一个未占用 ...
- Ubuntu上CUDA环境搭建
1.下载CUDA:https://developer.nvidia.com/cuda-toolkit-archive (如果已经安装了N卡驱动,最好用.deb,如果没有安装,可以用.run) 2.根据 ...
- C语言中内存分配问题:
推荐: C语言中内存分配 Linux size命令和C程序的存储空间布局 本大神感觉,上面的链接的内容,已经很好的说明了: 总结一下: 对于一个可执行文件,在linux下可以使用 size命令列出目标 ...
- Deep Residual Learning for Image Recognition这篇文章
作者:何凯明等,来自微软亚洲研究院: 这篇文章为CVPR的最佳论文奖:(conference on computer vision and pattern recognition) 在神经网络中,常遇 ...
- 用OpenGL实现跳跃的立体小球
一.目的 掌握OpenGL中显示列表对象的使用方法. 二.示例代码 Github地址 #include "stdafx.h" #include <GL/glut.h> ...
- core 文件查看
步骤: (1)无论你是用Makefile来编译,还是直接在命令行手工输入命令来编译,都应该加上 -g 选项. (2)一般来说,在默认情况下,在程序崩溃时,core文件是不生成的(很多Linux发行版在 ...
- MyBatis where标签语句
当 where 中的条件使用的 if 标签较多时,这样的组合可能会导致错误.当 java 代码按如下方法调用时: @Test public void select_test_where() { Use ...
- unity-------------------Unity5.X 新版AssetBundle使用方案及策略
Unity5.X 新版AssetBundle使用方案及策略 1.概览 Unity3D 5.0版本之后的AssetBundle机制和之前的4.x版本已经发生了很大的变化,一些曾经常用的流程已经不再使 ...
- (转)ffmpeg 中 av_read_frame_internal分析
作者: chenwei1983 时间: 2012-3-5 04:21 PM标题: ffmpeg 中 av_read_frame_internal分析 ...