展开动画demo

作者: honey缘木鱼 | 来源:发表于2018-06-06 12:38 被阅读146次

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

   [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.关闭动画代码:

     [_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.滑动关闭动画代码:

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

4.点击关闭

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

如有问题欢迎多多指教!

相关文章

网友评论

  • nenhall:效果图也不上一张!
    honey缘木鱼:@无夜之星辰 我不知道怎么转动画图,转的太大,传不上去,能否告知一下方法?:smile:
    无夜之星辰:@honey缘木鱼 还是没有补上:joy:
    honey缘木鱼:@nenhall 一直想发带动画的,录制好不能发上去,工作挺忙,渐渐忘了,今天补上

本文标题:展开动画demo

本文链接:https://www.haomeiwen.com/subject/fxlbsftx.html