【发布时间】:2014-07-06 01:42:18
【问题描述】:
在 stackoverflow 中为 pre-iOS 7.0 甚至 ios 7.0 提供了number 的解决方案。但没有一个对我有用。
似乎大多数人都无法将背景颜色设置为透明。在我的情况下,我想去掉透明颜色,这样“星期天 4 号”就会得到一个纯色背景,并且在向下滚动一天中的时间时不会像屏幕截图中那样干扰标题。
我尝试设置 tint color 和 contentview 没有任何运气:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
FTDayHeaderView *header = [[self recordTableView] dequeueReusableHeaderFooterViewWithIdentifier:@"FTDayHeaderView"];
//[header setTintColor:[UIColor greenColor]]; Didn't work either
header.contentView.backgroundColor = [UIColor blackColor];
return header;
}
这是FTDayHeaderView在IB中的设置:
我停用了opaque,没有任何效果。
更新: 根据要求。
#import "FTDayHeaderView.h"
@implementation FTDayHeaderView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
【问题讨论】:
-
你为什么不发表评论就投反对票?我做过研究,但对我没有用。努力提高生产力!!!
-
FTDayHeaderView 是 uiview 的子类吗?因此,您可以将 header.backgroundColor 设置为 blackColor,而不是 header.contentView.backgroundColor。也请分享 FTDayHeaderView 的 .m 文件内容。
-
FTDayHeaderView是UITableViewHeaderFooterView的子类。我没有任何喜悦地尝试了你的伎俩。[header setBackgroundColor:[UIColor greenColor]];更多详细信息,请参阅更新的问题。谢谢
标签: ios uitableview ios7