这是另一个想法。
将UIView *view 的背景设置为您想要的image.png,alpha = 0.5。让
w = view.bounds.size.width;
h = view.bounds.size.height;
创建另一个UIView *glassView alpha = 0.5,并将其添加为子视图:
[view addSubview:glassView];
glassView.frame = CGRectMake(0.0, h, w, 0.0);
创建一个UIImageView *glassImageView并将其image也设置为image.png,并将其添加为glassView的子视图:
[glassView addSubview:glassImageView];
glassImageView.frame = CGRectMake(0.0, -h, w, h);
现在设置动画以增加glassView 的高度和alpha,同时保持imageGlassView 的大小,如下所示:
[UIView beginAnimations:nil context:NULL]; {
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDelegate:self];
glassView.alpha = 1.0;
glassView.frame = CGRectMake(0.0, 0.0, w, h);
glassImageView.frame = CGRectMake(0.0, 0.0, w, h);
} [UIView commitAnimations];
公平地说,我还没有对此进行测试,但这些方面的一些东西似乎可行。再说一次,也许不是。如果您找到了完美的解决方案,请回帖。我很想知道如何做到这一点!