Ste*_*her 5 iphone core-animation rightbarbuttonitem
我试图在两个观点之间翻转.这很容易,代码在下面,但我也想同时翻转用于执行翻转的按钮.
当您在播放曲目时,您可以在iPod应用程序中看到此行为; 点击翻盖按钮可以在封面图片和曲目列表之间翻转,但同时会翻转按钮.
这是导航控制器上的一个页面,我要翻转的按钮是rightBarButtonItem.
这是我到目前为止的代码.这会翻转视图,但不会翻转右边的BarButton.
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: 0.5f];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
showingBackside = !showingBackside;
if (showingBackside) {
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft
forView: self.view
cache: YES];
[self.view addSubview: backside.view];
[frontside.view removeFromSuperview];
} else {
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight
forView: self.view
cache: YES];
[self.view addSubview: frontside.view];
[backside.view removeFromSuperview];
}
// flip image, too
NSString *newImage = showingBackside ? @"backside.png" : @"frontside.png";
[(self.navigationItem.rightBarButtonItem) setImage: [UIImage imageNamed: newImage]];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
(此处的图像翻转代码可能无法编译;我在尝试解释我尝试做的事情之后添加了它.)
在我遇到麻烦的地方,我想更改导航控制器中最右边的按钮,以便同时翻转.
我该怎么做呢?我的动画是什么视图,我是作为同一动画块的一部分还是作为单独的动画块执行的?任何提示将不胜感激,我绝对没有很好的处理动画.
| 归档时间: |
|
| 查看次数: |
4573 次 |
| 最近记录: |