iPhone 上默认的 TableView 部分标题背景颜色是什么?
我想自定义 TableView 部分标题并保留默认背景颜色。我使用 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)
部分。我需要根据设备(iPad 或 iPhone)更改字体大小。为此,调用下一个函数:
[UIColor colorWithHue:0.6 饱和度:0.33 亮度:0.69 alpha:0.6]。
但我手动找到了这些值。
I want to customize TableView section header and to leave default background color. I use - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)
section. I need to change font size depending on device (iPad or iPhone). For this purpose call next function:
[UIColor colorWithHue:0.6 saturation:0.33 brightness: 0.69 alpha:0.6].
But I found these values manually.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
ios7 的默认 tableview 部分标题背景颜色是
The default tableview section header background color for ios7 is
对于仅一行内容更改 TableView 标题部分的背景颜色
添加
TableView
委托willDisplayHeaderView
:For Change background Color of TableView Header Section Just One Line stuff
add
TableView
delegatewillDisplayHeaderView
:Objective-C:
斯威夫特:
Objective-C:
Swift:
我在一个应用程序中所做的就是创建这样的文本:
我使用 290 作为约束宽度,以在任一侧提供标签边框。然后我使用了这样的可拉伸图像:
并缩放它以适合标题中的文本:
最后,我创建了一个标签并将其添加为子视图:
What I've done in one of my apps is to create the text like so:
I used 290 for the constraint width to give the label boarders on either side. I then used a stretchable image like this:
And scaled it to fit the text in the header:
Finally, I created a label and added it as a subview:
对于 iOS 11,我在模拟器上选择了它的颜色。
对象c:[UIColor colorWithRed:247/255.0绿色:247/255.0蓝色:247/255.0 alpha:1.0]
对象
swift : UIColor(红色: 247/255.0,绿色:247/255.0,蓝色
但是,每当苹果改变颜色时我们就需要改变。
如何获得默认的节标题颜色?
for iOS 11, I picked it's color on simulator.
object c: [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1.0]
swift : UIColor(red: 247/255.0, green: 247/255.0, blue: 247/255.0, alpha: 1.0)
But, we need to change whenever Apple changed the color.
How to get default section header color?
十六进制颜色 - #e8e9ed
RGB 颜色 - UIColor(红色: 232/255, 绿色: 233/255, 蓝色: 237/255, alpha: 1)
或者你可以使用 #f7f7f7
Hex color - #e8e9ed
RGB color - UIColor(red: 232/255, green: 233/255, blue: 237/255, alpha: 1)
or you can use #f7f7f7