0

こんにちはすべての友人私は何かを聞きたいです、私はビューの間でスワイプするためにラベルを使用しようとしますが、私は問題を知ることができませんか?

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

2 に答える 2

3

あなたはこれを行うことができます-

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

于 2011-08-08T13:45:04.727 に答える
0

セットlabel.userInteractionEnabled = YES。のデフォルト値はUILabelですNO。したがって、すべてのタッチは無視されます。

userInteractionEnabledユーザーイベントを無視してイベントキューから削除するかどうかを決定するブール値。

@property(nonatomic、getter = isUserInteractionEnabled)BOOL userInteractionEnabled

説明このプロパティは、UIView親クラスから継承されます。このクラスは、このプロパティのデフォルト値をNOに変更します。

于 2011-08-08T13:52:08.530 に答える