UITableViewCell状态切换效果
UITableViewCell状态切换效果

效果图


源码
https://github.com/YouXianMing/Animations
//
// TableViewTapAnimationController.m
// Animations
//
// Created by YouXianMing on 15/11/27.
// Copyright © 2015年 YouXianMing. All rights reserved.
// #import "TableViewTapAnimationController.h"
#import "TableViewTapAnimationCell.h"
#import "UIView+SetRect.h"
#import "TapAnimationModel.h" @interface TableViewTapAnimationController () <UITableViewDataSource, UITableViewDelegate> @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *dataArray; @end @implementation TableViewTapAnimationController - (void)viewDidLoad { [super viewDidLoad];
} - (void)setup { [super setup]; // Init dataArray.
_dataArray = @[[TapAnimationModel modelWithName:@"YouXianMing" selected:YES],
[TapAnimationModel modelWithName:@"NoZuoNoDie" selected:NO],
[TapAnimationModel modelWithName:@"Animations" selected:NO]]; // Init TableView.
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(, , self.view.width, self.view.height - )
style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerClass:[TableViewTapAnimationCell class] forCellReuseIdentifier:@"TableViewTapAnimationCell"];
[self.view addSubview:self.tableView]; [self bringTitleViewToFront];
} #pragma mark - TableView相关方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _dataArray.count;
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { TableViewTapAnimationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableViewTapAnimationCell"];
cell.data = _dataArray[indexPath.row];
[cell loadContent];
[cell changeStateAnimated:NO]; return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { TableViewTapAnimationCell *cell = (TableViewTapAnimationCell *)[tableView cellForRowAtIndexPath:indexPath];
[cell showSelectedAnimation];
[cell changeStateAnimated:YES]; [tableView deselectRowAtIndexPath:indexPath animated:YES];
} - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return .f;
} @end
细节

UITableViewCell状态切换效果的更多相关文章
- Swift - UITableView状态切换效果
Swift - UITableView状态切换效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TableViewTapAn ...
- [Swift通天遁地]九、拔剑吧-(7)创建旋转和弹性的页面切换效果
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 使用ViewPager+Fragment实现选项卡切换效果
实现效果 本实例主要实现用ViewPage和Fragment实现选项卡切换效果,选项卡个数为3个,点击选项卡或滑动屏幕会切换Fragment并实现选项卡下方下边框条跟随移动效果. 本程序用androi ...
- WPF 编辑状态切换
有时候DataGrid编辑的时候一个属性需要根据别的属性呈现不同的编辑状态.这就需要一个做一个状态切换.比如地址是1的时候,读写类型是读写.只读.只写.地址是2的时候,就只读.状态栏切换为TextBo ...
- 巧用ViewPager 打造不一样的广告轮播切换效果
一.概述 如果大家关注了我的微信公众号的话,一定知道我在5月6号的时候推送了一篇文章,文章名为Android超高仿QQ附近的人搜索展示(一),通过该文可以利用ViewPager实现单页显示多个Item ...
- UIVIewController自定义切换效果-b
之前介绍动画时提过UIView的转场动画,但是开发中我们碰到更多的viewController的切换,ios中常见的viewcontroller切换有四种:模态视图,导航栏控制器,UITabBar ...
- Android实现程序前后台切换效果
本文演示如何在Android中实现程序前后台切换效果. 在介绍程序实现之前,我们先看下Android中Activities和Task的基础知识. 我们都知道,一个Activity 可以启动另一个Act ...
- 利用jquery写的一个TAB页切换效果
函数如下 /** *切换效果 */ function switab(tab,con,tab_c_css,tab_n_css,no) { $(tab).each(function(i){ if(i == ...
- Fragment保持状态切换,fragment状态切换
在使用Activity管理多个Fragment时,每次切换Fragment使用的是replace,结果导致出现xxx is not currently in the FragmentManager异常 ...
随机推荐
- PHP性能调优---PHP调试工具Xdebug安装配置教程
说到PHP代码调试,对于有经验的PHPer,通过echo.print_r.var_dump函数,或PHP开发工具zend studio.editplus可解决大部分问题,但是对于PHP入门学习的童鞋来 ...
- 支持多个title,解决主副标题分别对齐
- PivotGridControl控件应用
一.概述 PivotGridControl是DevExpress组件中的一个重要控件,在数据多维分析方面具有强大的功能,它不仅可以分析数据库中的数据,而且还能够做联机分析处理(OLAP),并且支持多种 ...
- 【解决】 64位笔记本丢失 MSVCR110.dll win10 phpstudy2017
启动程序报错如下: 无法启动此程序,因为计算机中丢失MSVCR110.dll.尝试重新安装该程序以解决此问题. 应该很容易就搜索到,缺少这样的dll文件,是没有安装Visual C++ Redistr ...
- HDU - 1716 排列2 水题
排列2 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- ASP.NET MVC , ASP.NET Web API 的路由系统与 ASP.NET 的路由系统是怎么衔接的?
ASP.NET MVC 的路由实际上是建立在 ASP.NET 的路由系统之上的. MVC 路由注册通常是这样的: RouteTable 是一个全局路由表, 它的 Routes 静态属性是一个 Ro ...
- awk 提取列
awk '{OFS="";print(substr($0,1,6),substr($0,74,18),substr($0,15,3),substr($0,18,8))}' inpu ...
- android viewStub
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 开发应用的时候,需要根据条件决定显示某个视图, 这个时候可以用ViewStub Stub ...
- luoguP3507 [POI2010]GRA 性质 + 动态规划
题目大意: 给定\(n\)个正整数,\(a, b\)两个人轮流取,\(a\)先手 每次可以取任意多的数,直到取完,每次的得分为取的数中的最小值 \(a, b\)都会使自己的得分减去对手的得分更大,询问 ...
- BZOJ 4945 UOJ #317 NOI2017 游戏 2-SAT 拓扑排序
http://uoj.ac/problem/317 https://www.lydsy.com/JudgeOnline/problem.php?id=4945 我现在的程序uoj的额外数据通过不了,b ...