美文网首页iOS
点击按钮标签+1消失效果

点击按钮标签+1消失效果

作者: 幻想无极 | 来源:发表于2019-08-26 17:00 被阅读0次
        //获取屏幕位置视图
        UIWindow * window=[[[UIApplication sharedApplication] delegate] window];
        CGRect rect = [sender convertRect: sender.bounds toView:window];
        //复制视图
        NSData * archiveData = [NSKeyedArchiver archivedDataWithRootObject:sender];
        UIButton* button = [NSKeyedUnarchiver unarchiveObjectWithData:archiveData];
        //修改坐标
        button.frame = rect;
        [window addSubview:button];
        //动画
        [UIView animateWithDuration:0.5 animations:^{
            button.y -= 50;
            button.alpha = 0.4;
        } completion:^(BOOL finished) {
            [button removeFromSuperview];
        }];
    

    相关文章

      网友评论

        本文标题:点击按钮标签+1消失效果

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