gpt4 book ai didi

iphone - 使用 UISwipeGestureRecognizer 滑动 View

转载 作者:行者123 更新时间:2023-11-28 20:44:28 31 4
gpt4 key购买 nike

嗨所有 friend 我想问点事,我尝试使用标签在 View 之间滑动但我不知道问题是什么?

UISwipeGestureRecognizer *swipe;
swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(Gest_SwipedLeft:)];
[swipe setDirection:UISwipeGestureRecognizerDirectionLeft];
[label addGestureRecognizer:swipe];
[swipe release];


-(void)Gest_SwipedLeft:(UISwipeGestureRecognizer *) sender{
ThirdQPage* y=[[ThirdQPage alloc]init];
[self.view.superview addSubview:[y view]];
[self.view removeFromSuperview];}

最佳答案

你可以这样做 -

- (void)hideView:(NSTimer *)timer
{
UIView *currentView = (UIView *)[timer userInfo];
[currentView addSubview:self.yourNewView];
return;
}

-(void)Gest_SwipedLeft:(UISwipeGestureRecognizer *) sender
{
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:yourCurrentView cache:YES];

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1];
[NSTimer scheduledTimerWithTimeInterval:0.5
target:self
selector:@selector(hideView:)
userInfo:yourCurrentView
repeats:NO];
[UIView commitAnimations];
}

您可以使用相同的逻辑从 newView 滑动回 oldView

关于iphone - 使用 UISwipeGestureRecognizer 滑动 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6982720/

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