//获取屏幕位置视图
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];
}];
网友评论