开发者

Animate UIImageView with overlayed buttons

The main menu screen I have for my iOS app has some Round Rect buttons on top of a UIImageView. I've got it all loading properly from an XIB. But I want to fade the image out and load a new image in behind the buttons.

If I point at the imageview, I can change it to a new image, but the buttons are 'underneath' the imageview so I can'开发者_JAVA百科t touch the buttons anymore.

Is there a way to preserve the layer?


So it's the layer and not the animation you have a problem with?

You can bring forward your view with:


[self.view bringSubviewToFront:yourView];

or you can make a view not userInteractionEnabled which means your click will pass through the layer


yourView.userInteractionEnabled = NO;


try this with your imageView:

[UIView animateWithDuration:0.2
     animations:^{imageView.alpha = 0.0;}
     completion:^(BOOL finished){ imageView.alpha = 1.0; imageView.image = [UIImage imageNamed:@"yourImage.png" }];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜