ios - uitableview header background not shown until scroll -


i used following code set header view of uitableview section. problem is, background color (mainlightcolor_2) doesn't show until scroll tableview. how can make background color shown on load?

- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section {   uiview *headerview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 24)];   headerview.backgroundcolor = [utility mainlightcolor_2]; //mainlightcolor blue color    uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(5, 2, 200, 20)];   label.backgroundcolor = [uicolor clearcolor];   label.textcolor = [utility maindarkcolor];   label.text = @"past activities";   [headerview addsubview:label];    return headerview; } 

before scroll: before scroll

after scroll: after scroll

you should implement - (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section method.

- (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section{     return 24; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -