如何在背面用另一个UIButton翻转UIButton?

Flo*_*ked 4 iphone objective-c

我想要一个按钮,背面有另一个按钮.当您按下按钮时,它应该水平翻转并显示另一个按钮.Apple在ipod-App中做到了这一点.当您听到歌曲时,您可以按导航栏右侧站点上的按钮,然后翻转视图,您可以看到专辑中的所有歌曲.但兴趣点是右侧的按钮翻转视图水平.我怎样才能做到这一点?

alt text http://img51.imageshack.us/img51/585/welyrics2jpg.png

谢谢你的回答!

Sam*_*man 5

我不明白这个atm.

我的iPhone教练在一段时间内为我做了这件事......但我并没有看他做了什么.

所以继承代码..H

#import <UIKit/UIKit.h>

@interface flipTesViewController : UIViewController {
IBOutlet UIView *containerView;

UIImageView *heads;
UIImageView *tails;
}
-(IBAction)test;

@end
Run Code Online (Sandbox Code Playgroud)

.M

#import "flipTesViewController.h"

 @implementation flipTesViewController





-(IBAction)test{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:containerView cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(test)];
[UIView setAnimationDuration:.5];
if(heads.tag==1){
    [containerView addSubview:heads];
    heads.tag=2;
}
else{
    [containerView addSubview:tails];
    heads.tag=1;
}

[UIView commitAnimations];
}



- (void)viewDidLoad {
[super viewDidLoad];

heads = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NZHeads.png"]];
tails = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NZTails.png"]];

[containerView addSubview:heads];

}
//other method built in to view based template
@end
Run Code Online (Sandbox Code Playgroud)