English 中文(简体)
布尔总是假的 即使我强加真实
原标题:Boolean is always false even if I impose true

我有一个UIVIView, 在我使用 UILONPressGressGressRecognize 然后使用 UIPanGestureRecognize 之前, 我在哪里使用 UIPanGestureRecognize 。 对于 UIPGestureRecognize 我得到关于 UILongPressGressDretureRecognize的压力的信息, 但我的应用程序不使用布林, 即使我强制使用, 这总是假的 。 我该怎么做?

 -(IBAction)longGesture:(UILongPressGestureRecognizer *)gestureRecognizer{


   if(fromRiga ==0){
    if ([gestureRecognizer state]==UIGestureRecognizerStateBegan){
        self.inLongPress = YES;
        self.view.backgroundColor =[UIColor darkGrayColor];
        gestureRecognizer.allowableMovement=200;

      }else if([gestureRecognizer state]==UIGestureRecognizerStateEnded){
        self.inLongPress = NO;
      }
}

 - (IBAction)panGesture:(UIPanGestureRecognizer *)gestureRecognizer
  {
    NSLog(@"inLongPress is %@", self.inLongPress ? @"YES": @"NO");
  }

提前感谢

最佳回答

当您触摸视图并检查此刻之后的动向时, Pan 识别器会立即触发。 长的 按 识别器总是在很久之后触发, 然后( 在 < em > long < / em > 周期结束后) 显示器就会触发。 我怀疑, < code > panGesture 总是在 < code > longGestur < / code > 之前被调用。 也许 Pan 识别器会完全取消长的按 识别器 。

您应该通过添加更多 NSLog 语句来检查会发生什么。


-(IBAction)longGesture:(UILongPressGestureRecognizer *)gestureRecognizer {
    NSLog(@"Long gesture");

    if (fromRiga == 0){
        if ([gestureRecognizer state] == UIGestureRecognizerStateBegan){
            self.inLongPress = YES;
            self.view.backgroundColor =[UIColor darkGrayColor];
            gestureRecognizer.allowableMovement=200;

            NSLog(@"Long gesture began, self.iLongPress = %@", self.iLongPress ? @"YES" : @"NO");
        } else if([gestureRecognizer state] == UIGestureRecognizerStateEnded) {
            self.inLongPress = NO;
            NSLog(@"Long gesture ended, self.iLongPress = %@", self.iLongPress ? @"YES" : @"NO");
        }
    }
}

- (IBAction)panGesture:(UIPanGestureRecognizer *)gestureRecognizer {
    NSLog(@"Pan gesture, self.iLongPress = %@", self.iLongPress ? @"YES" : @"NO");
}
问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签