我有一個UIViewController
與UIView
的子類上它叫customSubView1
。然後在customSubView1上,我有另一個UIView
的子類customSubView2
。iPhone的SDK - 轉發從UIViewController觸及子視圖
當我將touchesBegan/touchesMoved/etc
放入UIViewController
類中時,我可以捕獲所有子視圖上的所有事件。但我希望能夠在我的自定義類中處理它們。
我一直在讀,UIViewController
類需要'轉發'觸摸事件的子視圖,但我一直沒能找到任何示例代碼來做到這一點。有人有什麼主意嗎?
非常感謝, 佈雷特
他們是所有的禮物,但沒有人被稱爲。 – Brett
而你的意見是存在的,可見的,有'userInteractionEnabled = YES'(應該默認爲直UIView子類)?它們是否在scrollView中,也許?您是否嘗試過以最基本的方式首先解決其他錯誤原因? 'CustomViewClass * myCustomTestView = [[CustomViewClass alloc] initWithFrame:CGRectMake(100,100,100,100)]; myCustomView.userInteractionEnabled = YES; myCustomView.backgroundColor = [UIColor redColor]; [self.view addSubview:myCustomView];'應該工作。 – fzwo
我的所有觀點都可見 – Brett