ios - how to change height between UITableView and Navigation Bar -


got uitableviewstylegroupedand uitableviewstyleplain changes in storyboard, found that, top edge of plain table view sticks navigation bar, while top gap in grouped style somehow because of header view.

enter image description here

but, picture show, gap "a" bigger "b", why? there hidden elements around "a"? how manage gap stuck bar?

what's default size of gap "a" , "b"? how make "a" equal "b", "setting"

enter image description here

below try-out


tried set heightforheaderinsection: , viewforheaderinsection: below

- (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section { return 0.0f; }  - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { uiview * header = [[uiview alloc] init]; header.backgroundcolor = [uicolor redcolor]; [self.view addsubview:header];  return header; } 

enter image description here


tried heightforfooterinsection: , viewforfooterinsection:, below

- (cgfloat)tableview:(uitableview *)tableview heightforfooterinsection:(nsinteger)section { return 0.0f; }  - (uiview *)tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section { uiview * footer = [[uiview alloc] init]; footer.backgroundcolor = [uicolor yellowcolor]; [self.view addsubview:footer]; return footer; } 

enter image description here


it looks neither of them work expected, gap "a" there , not changed.

the weird is, height of header , footer still there, looks minium height,

even if setting height zero.

not sure why issue occurring, workaround grouped tableview "stuck" bottom of navigation bar:

cgfloat myinset = *height of gap a* self.tableview.contentinset = uiedgeinsetsmake(-myinset, 0, 0, 0); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -