归档应用程序后,UILongPressGestureRecognizer无法正常工作

时间:2016-10-24 08:24:44

标签: ios objective-c xcode8 uilongpressgesturerecogni

在iPad上测试时,我可以成功调用UILabel中User Interaction Enabled:附带的方法。

在我为企业部署归档应用程序后,UILongPressGestureRecognizer不再有效。

除了手动勾选@interface BGMSetMenuViewController : UIViewController <UIGestureRecognizerDelegate>

之外,我已经添加了以下代码

在.h文件中:

- (void)viewDidLoad
{
    [super viewDidLoad];

    itemPriceLabel.userInteractionEnabled = YES;
    itemNameLabel.userInteractionEnabled = YES;

    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressSetMenuPrice:)];
    longPress.delegate = self;
    [itemPriceLabel addGestureRecognizer:longPress];
}

#pragma mark - UILongPressGestureRecognizerDelegate

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
  return YES;
}

- (void)longPressSetMenuPrice:(UILongPressGestureRecognizer*)gesture
{
  if (gesture.state == UIGestureRecognizerStateEnded) {

    BGMPasscodeViewController *passcodeVC = [[BGMPasscodeViewController alloc] initWithNibName:@"BGMPasscodeViewController" bundle:nil];
    self.providesPresentationContextTransitionStyle = YES;
    self.definesPresentationContext = YES;
    [passcodeVC setModalPresentationStyle:UIModalPresentationOverCurrentContext];
    [self presentViewController:passcodeVC animated:YES completion:nil];

  }
}

在.m文件中:

\n

这里有谁有相同的经历?

请注意,这适用于Xcode 7和iOS 9。

现在,我正在使用Xcode 8并在iOS 10.0.2中进行测试,而且它已经不再适用了。

1 个答案:

答案 0 :(得分:0)

尝试以下代码:设置YES以在故事板中标记userIntractionEnabled

df.plot.hexbin(x=df.columns, y=df.index.get_values())