2012-12-11 29 views
0

我需要在xcode中提供一个滑动条来提醒用户他输入了错误的数据。 我希望它在屏幕的顶部出现约1秒钟,然后消失,所以用animcation东西并提交,我有这样的代码为它编写的,它还挺做这项工作,除了Facebook用户界面行为,iOS下滑imageview

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:.3]; 
CGPoint center = self.slidingView.center; 
center.y += self.slidingView.frame.size.height; 
self.errorLabel.center = center; 
self.slidingView.center = center; 
self.slidingView.transform = CGAffineTransformMakeRotation(0); 

[UIView commitAnimations]; 

[self.view bringSubviewToFront:self.slidingView]; 
[self.view bringSubviewToFront:self.errorLabel]; 

现在这个problrem是最初slidingview背后却隐藏着另一个的UIView,但我需要它只是滑下去,现在这出现在一个野蛮的方式(因为调用bringSubviewToFront的。

任何想法。

回答

0

为什么在你进行动画调用之前你不把子视图放在前面?

更好的是,隐藏视图,然后将子视图放在前面。之后,与您已有的滑动动画一起进行“淡入淡出”动画。

+0

因为我想让它在它位于后面的控件后面滑动窗体,那么fronttofront调用只会将它移动到z索引处。 – Kalamantina

+0

对。所以如果你在开始时将前面的子视图调用到前面,它不应该是震动的(因为滑动视图还没有完全出现) – Msencenb