我通过在我的整个视图 alpha 集 0.5 上覆盖 UIImage 然后在其上覆盖另一个 UIImage 来在情节提要中制作自定义警报,最初设置为隐藏。
IBAction
然后将这些设置为hidden = NO
然后,我使用此处另一篇文章中的一些代码对此进行了动画处理,以模拟AlertView
“反弹”。
.m 在 IBAction 下
tint.hidden = NO; <<tint image
storm.hidden = NO; << my image view
mybtn.hidden = NO; << button to dismiss the view
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
self.view.alpha = 1.0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped)];
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
[UIView commitAnimations];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped)];
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
[UIView commitAnimations];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.view.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
问题是整个视图动画和反弹,包括下面的视图控制器,我只希望 UIImagestorm
动画而不是整个屏幕。
到目前为止,我尝试更改Self
为 my UIImage
,也更改UIView
为UIImageview
现在我没有想法了