просмотр с помощью UISwipeGestureRecognizer - PullRequest
0 голосов
/ 08 августа 2011

Привет всем, мой друг! Я хочу кое-что спросить, я пытаюсь использовать ярлык для прокрутки между видами, но я не могу понять проблему?

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];}

Ответы [ 2 ]

3 голосов
/ 08 августа 2011

Вы могли бы сделать это -

- (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.

0 голосов
/ 08 августа 2011

Set label.userInteractionEnabled = YES. Значение по умолчанию для UILabel равно NO, поэтому все касания игнорируются.

userInteractionEnabled Логическое значение, определяющее, является ли пользователь события игнорируются и удаляются из очереди событий.

@ свойство (неатомное, getter = isUserInteractionEnabled) BOOL userInteractionEnabled

Обсуждение Это свойство унаследовано от UIView родительский класс. Этот класс изменяет значение по умолчанию этого собственность на №.

...