我正在尝试将 UIButton 添加到 tableView,但是当我执行以下操作时:
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frameWidth, 200)];
UIButton *addSource = [UIButton buttonWithType:UIButtonTypeCustom];
[addSource addTarget:self action:@selector(addBoard:) forControlEvents:UIControlEventTouchUpInside];
[addSource setImage:[UIImage imageNamed:@"addsource.png"] forState:UIControlStateNormal];
[addSource setBackgroundColor:[UIColor grayColor]];
[headerView addSubview:addSource];
self.tableView_.tableHeaderView = headerView;
我在那里没有看到 UIButton。当我尝试使用 UILabel 时,它就在那里。为什么是这样?