ios tableView滑动动画
来源:互联网 发布:厦门软件培训 编辑:程序博客网 时间:2024/05/22 01:59
今天就分享给大家一个比较实用的动画
ios 中经常用的到列表 tableView, 那么大家在滑动中是否感觉有些单调呢?
如果滑动的时候有些动画 是否会更好些呢? 这些问题也是我所考虑的
下面就教大家2种简单实用的动画
这些效果都是我亲测的,大家可以放心使用
第一种是模仿百度贴吧客户端 滑动的效果
<span style="font-size:18px;">- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row>=tableViewNum) { cell.contentView.alpha = 0.1; CGAffineTransform transformScale = CGAffineTransformMakeScale(2,2); CGAffineTransform transformTranslate = CGAffineTransformMakeTranslation(0, 0); cell.contentView.transform = CGAffineTransformConcat(transformScale, transformTranslate); [tableView bringSubviewToFront:cell.contentView]; [UIView animateWithDuration:0.5 animations:^{ cell.contentView.alpha = 1; cell.contentView.transform = CGAffineTransformIdentity; } completion:nil]; tableViewNum= indexPath.row; }}</span>
这份代码直接复制黏贴, 就可以使用了
至于 if 是为了第一次加载才游动画显示
如果去掉if 则每次滑动都会有动画显示,
那么下面是第2种从左或右加载
/*
CGFloat rotationAngleDegrees = 0;
CGFloat rotationAngleRadians = rotationAngleDegrees * (M_PI/180);
CGPoint offsetPositioning = CGPointMake(-200, -20);
CATransform3D transform = CATransform3DIdentity;
transform = CATransform3DRotate(transform, rotationAngleRadians, 0.0, 0.0, 1.0);
transform = CATransform3DTranslate(transform, offsetPositioning.x, offsetPositioning.y, 0.0);
UIView *card = [cell contentView];
card.layer.transform = transform;
card.layer.opacity = 0.1;
[UIView animateWithDuration:0.5f animations:^{
card.layer.transform = CATransform3DIdentity;
card.layer.opacity = 1;
}];
*/
和上面的使用方法一样
是不是很简单呢?
有一点请注意 动画效果只支持6.0以上
最后请喜欢我博客或帮助到你的人 ,给予我一点点支持,你的支持才是我最大的动力。
- ios tableView滑动动画
- iOS tableview 滑动删除
- iOS tableview 滑动删除
- IOS TableView Cell出场动画
- iOS滑动卡片动画
- iOS TableView横向滑动删除记录
- iOS 怎么让tableView滑动最底端
- iOS tableView滑动隐藏/显示tabbar
- ios tableview section标题不滑动问题
- IOS 非常流畅的滑动tableView
- [iOS] 判断tableView向上或向下滑动
- iOS tableView滑动出现多个按钮
- iOS tableview 区头随着cell滑动
- iOS tableView滑动到区头的时候
- IOS TableView 左滑动删除Cell方法
- IOS TableView 动画相关问题(个人)
- IOS-TableView里面cell的显示动画
- tableview 动画
- router map
- VPN进行数据保护和网络安全
- bc命令详解
- 文件描述符
- C语言中宏的使用
- ios tableView滑动动画
- hdu2833 WuKong
- IOS 条形码技术
- DialogBoxParamA
- mysql物理还原
- mysql主从同步常见异常及恢复方法
- VPN的解释 - 简化的VPN的基础知识
- POJ 1679 The Unique MST 次小生成树
- Android:WebView基本使用