gpt4 book ai didi

iphone - 如何水平翻转 UIButton 和背面的另一个 UIButton?

转载 作者:太空狗 更新时间:2023-10-30 04:02:58 27 4
gpt4 key购买 nike

我想要一个背面有另一个按钮的按钮。当您按下按钮时,它应该水平翻转并显示另一个按钮。 Apple 在 ipod-App 中做到了这一点。当您听到一首歌曲时,您可以按下导航栏右侧的按钮,然后 View 会翻转,您可以看到专辑中的所有歌曲。但有趣的是右侧的按钮会随着 View 水平翻转。我该怎么做?

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

感谢您的回答!

最佳答案

我不明白这个自动取款机。

我的 iPhone 教练不久前为我做了这件事..但我没有看他做了什么。

代码如下。.h

#import <UIKit/UIKit.h>

@interface flipTesViewController : UIViewController {
IBOutlet UIView *containerView;

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

@end

.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

关于iphone - 如何水平翻转 UIButton 和背面的另一个 UIButton?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2079611/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com