iOS

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

2019-08-26  本文已影响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];
    }];
上一篇 下一篇

猜你喜欢

热点阅读