self.channelStarter = [[ChannelStarter alloc] initWithFrame:CGRectMake(0,0, self.tv.frame.size.width, 44)];
self.tv.tableHeaderView = self.channelStarter;
po self.tv.talbeHeaderView
<ChannelStarter: 0x7fd0c1d6e420; frame = (0 0; 414 44); layer = <CALayer: 0x7fd0c1d49ee0>>
//ChannelStarter.m
- (id)init {
self = [super init];
self.backgroundColor = [UIColor yellowColor];
return self;
}
我没有看到黄色背景,只是我的桌面视图。
答案 0 :(得分:0)
尝试实现方法initWithFrame:
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if(self) {
self.backgroundColor = [UIColor yellowColor];
}
return self;
}