0
視圖獲取觸摸我想有使用的頂視圖(UIView的子類),它捕捉觸摸與子視圖
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
...
.H
@interface XView : UIView<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView * tableView;
@end
這工作得很好,如果視圖是空的,但只要我插入(addSubview)可以說一個UITableView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
self.tableView = [[UITableView alloc] initWithFrame:self.frame];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
}
return self;
}
比內XVIEW不trigge觸摸方法紅色