相关疑难解决方法(0)

如何向UIView添加触摸事件?

如何向UIView添加触摸事件?
我尝试:

UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, nextY)] autorelease];
[headerView addTarget:self action:@selector(myEvent:) forControlEvents:UIControlEventTouchDown];
// ERROR MESSAGE: UIView may not respond to '-addTarget:action:forControlEvents:'
Run Code Online (Sandbox Code Playgroud)

我不想创建子类和覆盖

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
Run Code Online (Sandbox Code Playgroud)

events objective-c touch uiview ios

272
推荐指数
9
解决办法
32万
查看次数

标签 统计

events ×1

ios ×1

objective-c ×1

touch ×1

uiview ×1