2013-05-01 60 views
1

我有一個uicollectionviewcontroller,我用它在屏幕底部創建一個小工具欄。我將uicollectionviewcontroller的視圖添加到另一個視圖控制器的視圖。我的問題是它不會將觸摸事件轉發到它下面的視圖。我確實將它移動到了底部,並且工作了一段時間,但現在我需要使用2個自選視圖。如何將觸摸事件轉發到uicollectionview背後的視圖?

我該如何將觸摸事件轉發到uicollectionviewcontroller視圖下的視圖?

回答

2

如果問題仍然相關,可以使用以下內容來實現觸摸轉發。

  1. 子類UICollectionView
  2. 覆蓋 - (無效)touchesEnded:(NSSet中*)觸摸withEvent:方法(的UIEvent *)事件;

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ 
        [super touchesEnded:touches withEvent:event]; 
        [self.yourCustomDelegate forwardTouches:touches withEvent:(UIEvent *)event]; 
    } 
    

    也就是說UICollectionView如何能保持其對用戶交互的響應能力,並同時轉發收到的觸摸。