Ios 带有自定义UIView的UITableView头视图

Ios 带有自定义UIView的UITableView头视图,ios,uitableview,Ios,Uitableview,YJHomeViewContoller.m - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { return [YJHeaderView view]; } YJHeadView.m: + (instancetype)view { YJHeaderView *view = [[[NSBundle mainBundle] loadNibNamed:@"Y

YJHomeViewContoller.m

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return [YJHeaderView view];
}
YJHeadView.m:

+ (instancetype)view
{
    YJHeaderView *view = [[[NSBundle mainBundle] loadNibNamed:@"YJHeaderView" owner:nil options:nil] lastObject];
}

YJHeaderView是我的自定义视图,我用xib来描述。YJHeaderView中有一个UISWitch。问题是当我运行应用程序时,无法触摸UISWitch。

是否实现了heightForHeader方法?是否已将UISWitch userinteraction启用为yes?