Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios viewForHeaderInSection绘制背景,但仅当视图位于屏幕顶部时_Ios_Cocoa Touch_Uiview_Uitableview - Fatal编程技术网

Ios viewForHeaderInSection绘制背景,但仅当视图位于屏幕顶部时

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

My table view controller实现ViewForHeaderSection函数,以自定义字体返回节标签

目前,我们使用透明背景,但如果单元格开始在标题视图后面滚动,这看起来不太好

我想为标题视图绘制一个从透明到白色的渐变,但只针对顶部卡住的视图

显然,
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
        }