ios - Problems setting view for header in a grouped table -


i'm trying customize headers sections in grouped table. view set first section in table looks fine, subsequent section headers cropped @ top , @ bottom (in screenshot shown @ top):

iphone_groupedtable_header

i've been trying different x , y values frame.size.origin, remains looking same. code:

- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section {    if (section == 1) {           uiview *wrapper = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.tableview.frame.size.width, 70)];           [wrapper setbackgroundcolor:[uicolor clearcolor]];            uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(10, 20, self.tableview.frame.size.width, 20)];           label.text = nslocalizedstring(@"section 2 header", @"");           [label setfont:[uifont boldsystemfontofsize:15]];           [label setbackgroundcolor:[uicolor clearcolor]];            [wrapper addsubview:label];            return wrapper;    }     else           return nil; }  - (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section {    if (section == 1)           return 70;    else           return 0; } 

i same section headers, , first 1 correctly displayed, i'm doing wrong? regarding issue, possible dynamically know height of uilabel take once text , font size known, or should set frame size "at guess"? same height of view header set in heightforheaderinsection: method.

thanks!

you have not set height header sections other section 1 in code,you should remove if(section==1) condition , provide common height each section , check

- (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section {    if (section == 1)           return 70;    else           return 0; } 

thanks, mittal.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -