gpt4 book ai didi

ios - 如何翻转正面有标签和背面有另一个标签的 View - 参见图片

转载 作者:行者123 更新时间:2023-11-28 19:03:39 25 4
gpt4 key购买 nike

单击按钮时如何翻转正面有标签而背面有另一个标签的 View ?看起来像下图的东西。

创建这种效果的逻辑是什么? enter image description here

谢谢

编辑:

很抱歉造成混淆,但请注意,我只是在谈论 View 而不是 ViewController,此效果将在同一个 viewController 中发生。我更新了图像以反射(reflect)我所说的 View 是主视图内的 subview 。

最佳答案

我也遇到过非常相似的情况,在 ViewController1 上单击按钮后,我必须移动到另一个 ViewController2。我使用了这段代码,

//code this in ViewController1
-(IBAction)flipView:(id)sender
{
ViewController2 *view2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:1.0];
[[self navigationController] pushViewController:view2 animated:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[view2 release];
}

//code this in ViewController2 on click of back button
-(IBAction)flipView:(id)sender
{
[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:1.0];

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[[self navigationController] popViewControllerAnimated:YES];
[UIView commitAnimations];
}

但在这段代码中我使用了 2 个类,如果您觉得合适,请使用这段代码。希望能在一定程度上解决您的问题。

关于ios - 如何翻转正面有标签和背面有另一个标签的 View - 参见图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22559225/

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