我有一個名爲TargetView的子類UIView,它包含幾個CGPath。當用戶點擊任何CGPath(在UIView的touchesBegan中)時,我想對父視圖控制器進行更改。這裏是TargetView的代碼(UIView)UIViewController需要響應來自子類UIView的事件
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint tap = [[touches anyObject] locationInView:self];
if(CGPathContainsPoint(region, NULL, tap, NO)){
// ...do something to the parent view controller
}
}
我該怎麼做?謝謝!