Ios viewForHeaderInSection绘制背景,但仅当视图位于屏幕顶部时
My table view controller实现ViewForHeaderSection函数,以自定义字体返回节标签 目前,我们使用透明背景,但如果单元格开始在标题视图后面滚动,这看起来不太好 我想为标题视图绘制一个从透明到白色的渐变,但只针对顶部卡住的视图 显然,Ios viewForHeaderInSection绘制背景,但仅当视图位于屏幕顶部时,ios,cocoa-touch,uiview,uitableview,Ios,Cocoa Touch,Uiview,Uitableview,My table view controller实现ViewForHeaderSection函数,以自定义字体返回节标签 目前,我们使用透明背景,但如果单元格开始在标题视图后面滚动,这看起来不太好 我想为标题视图绘制一个从透明到白色的渐变,但只针对顶部卡住的视图 显然,if(section==0)不起作用 这有什么诀窍吗 有时,在发布到堆栈溢出之前,最好先考虑一下。这是我为记录找到的解决方案。我希望它能帮助别人 NSArray * visibleIndexes = [tableV
if(section==0)
不起作用
这有什么诀窍吗 有时,在发布到堆栈溢出之前,最好先考虑一下。这是我为记录找到的解决方案。我希望它能帮助别人
NSArray * visibleIndexes = [tableView indexPathsForVisibleRows];
NSIndexPath * firstVisibleIndex = [visibleIndexes objectAtIndex:0];
if (section == firstVisibleIndex.section) {
// configure the header at the top
}
else {
// configure other headers
}
有时,在发布到堆栈溢出之前,最好先考虑一下。这是我为记录找到的解决方案。我希望它能帮助别人
NSArray * visibleIndexes = [tableView indexPathsForVisibleRows];
NSIndexPath * firstVisibleIndex = [visibleIndexes objectAtIndex:0];
if (section == firstVisibleIndex.section) {
// configure the header at the top
}
else {
// configure other headers
}