0

所以在一个视图中,比如说“A”,我有多个 UIImage 视图和 UITextViews。现在,这一切都是以编程方式完成的。在同样的观点中,我这样做:

if(!_productionLinesCollectionViewController)
{
    _productionLinesCollectionViewController = [[self storyboard]instantiateViewControllerWithIdentifier:@"ProductionLinesCollection"];
    _productionLinesCollectionViewController.productionLines = [_plant.productionLines allObjects];
    _productionLinesCollectionViewController.initX = 0;
    _productionLinesCollectionViewController.initY = _totalHeight;
    _productionLinesCollectionViewController.width = 668;
}

[self.scrollView addSubview:_productionLinesCollectionViewController.view];

现在由于某种原因,这是“取消”我之前分配的所有 UITapGestures(在同一视图中)(此外,此代码在其他一些视图中 100% 工作)。每当我删除这段代码时,我的手势就会再次起作用。任何想法为什么?

谢谢!

UIImageView *playMovieImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"press_to_play.png"]];
playMovieImage.frame = CGRectMake(30, _totalHeight, 608, 456);
UITapGestureRecognizer *tapRecognizer;
tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(playMovie:)];
[playMovieImage addGestureRecognizer:tapRecognizer];
playMovieImage.userInteractionEnabled = YES;
[self.scrollView addSubview:playMovieImage];
4

0 回答 0