前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >展开动画demo

展开动画demo

作者头像
honey缘木鱼
发布2018-06-07 10:34:20
5840
发布2018-06-07 10:34:20
举报
文章被收录于专栏:娱乐心理测试娱乐心理测试

公司要求有个简单的动画效果,自己做了个小demo。demo地址(https://github.com/dt8888/AnimationShow) 1.展开动画代码:

代码语言:javascript
复制
   [UIView beginAnimations:nil context:nil];
    _upBtn.transform = CGAffineTransformScale(CGAffineTransformIdentity,1,1);
    _upBtn.frame = CGRectMake((kScreenWidth-20)-80, 0, 40, 85);
    _delectBtn.transform = CGAffineTransformScale(CGAffineTransformIdentity,1,1);
    _delectBtn.frame = CGRectMake((kScreenWidth-20)-120, 0, 40, 85);
    [UIView commitAnimations];

2.关闭动画代码:

代码语言:javascript
复制
     [_editBtn setTitle:@"编    辑" forState:UIControlStateNormal];
    [UIView beginAnimations:nil context:nil];
    _upBtn.transform = CGAffineTransformScale(CGAffineTransformIdentity,1,1);
    _upBtn.frame = CGRectMake((kScreenWidth-20)-40, 0, 40, 85);
    _delectBtn.transform = CGAffineTransformScale(CGAffineTransformIdentity,1,1);
    _delectBtn.frame = CGRectMake((kScreenWidth-20)-40, 0, 40, 85);
    [UIView commitAnimations];

3.滑动关闭动画代码:

代码语言:javascript
复制
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    //循环显示的cell
    for (AnimationCell *item in self.visibleCells) {
        [item closeAnimationsBtn];
    }
}

4.点击关闭

代码语言:javascript
复制
-(void)closeOtherCellLeftSwipe:(NSIndexPath *)indexPath
{
    for (AnimationCell *item in self.visibleCells) {
        NSIndexPath *path = [self indexPathForCell:item];
        if(indexPath.section!=path.row){
            [item closeAnimationsBtn];
        }
    }
}

如有问题欢迎多多指教!

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.06.06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档