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状态切换效果的更多相关文章

  1. Swift - UITableView状态切换效果

    Swift - UITableView状态切换效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TableViewTapAn ...

  2. [Swift通天遁地]九、拔剑吧-(7)创建旋转和弹性的页面切换效果

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  3. 使用ViewPager+Fragment实现选项卡切换效果

    实现效果 本实例主要实现用ViewPage和Fragment实现选项卡切换效果,选项卡个数为3个,点击选项卡或滑动屏幕会切换Fragment并实现选项卡下方下边框条跟随移动效果. 本程序用androi ...

  4. WPF 编辑状态切换

    有时候DataGrid编辑的时候一个属性需要根据别的属性呈现不同的编辑状态.这就需要一个做一个状态切换.比如地址是1的时候,读写类型是读写.只读.只写.地址是2的时候,就只读.状态栏切换为TextBo ...

  5. 巧用ViewPager 打造不一样的广告轮播切换效果

    一.概述 如果大家关注了我的微信公众号的话,一定知道我在5月6号的时候推送了一篇文章,文章名为Android超高仿QQ附近的人搜索展示(一),通过该文可以利用ViewPager实现单页显示多个Item ...

  6. UIVIewController自定义切换效果-b

      之前介绍动画时提过UIView的转场动画,但是开发中我们碰到更多的viewController的切换,ios中常见的viewcontroller切换有四种:模态视图,导航栏控制器,UITabBar ...

  7. Android实现程序前后台切换效果

    本文演示如何在Android中实现程序前后台切换效果. 在介绍程序实现之前,我们先看下Android中Activities和Task的基础知识. 我们都知道,一个Activity 可以启动另一个Act ...

  8. 利用jquery写的一个TAB页切换效果

    函数如下 /** *切换效果 */ function switab(tab,con,tab_c_css,tab_n_css,no) { $(tab).each(function(i){ if(i == ...

  9. Fragment保持状态切换,fragment状态切换

    在使用Activity管理多个Fragment时,每次切换Fragment使用的是replace,结果导致出现xxx is not currently in the FragmentManager异常 ...

随机推荐

  1. drools7 (三、kmodule 介绍)

    注意几点: 1. kmodule 有默认的加载路径, 看  KieModuleModelImpl 这个类的源代码 public class KieModuleModelImpl implements ...

  2. day1作业:编写登陆接口

    作业一:编写登陆接口 1.输入用户名和密码 2.认证成功后显示欢迎信息 3.输错三次后锁定 思路:要求是编写登陆接口,那么要有一个存放用户信息的模块:三次后锁定,要有一个存放锁定用户信息的模块:我们知 ...

  3. svn错误 svnserve.conf:12: Option expected解决办法

    经常有新手配置基于svnserve的subversion服务器后,在客户端访问subversion版本库时出现这个错误:svnserve.conf:12: Option expected为什么会出现这 ...

  4. Proxy 代理

    意图 为其他对象提供一种代理以控制对这个对象的访问 动机 对一个对象进行访问控制的原因是为了只有在我们确实需要这个对象时才对它进行创建和初始化 典型例子:智能指针的实现,通过引用计数来决定“=” 复制 ...

  5. 使用chrales抓包IOS的https(pc+手机)

    1.安装SSL证书到手机 点击 Help -> SSL Proxying -> Install Charles Root Certificate on a Mobile Device 2. ...

  6. 2017 Bangladesh National High School Programming Contest ( National Round, Senior Group ), NHSPC 2017 题解

    [题目链接] A. Charm Is Not Always Enough 模拟一下就可以了. #include <bits/stdc++.h> using namespace std; i ...

  7. CSUOJ 1560 图书管理员的表白方式

    Description 小V是中南大学图书馆的图书管理员,每天要整理很多同学们还回来的书.久而久之,他认识了很多常来图书馆的同学,比如说小L.简而言之吧,就是小V喜欢上了小L,并且想在下一次她来还书的 ...

  8. HDU - 1051 Wooden Sticks 贪心 动态规划

    Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)    ...

  9. Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server.

    报错信息:Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQL ...

  10. springmvc遇见406错误的问题分析

    如果springmvc遇到406错误: 90%没有加入Jackson的包 10%因为后缀为.html 10%的情况,解决方案为加多一个映射,使用.action