iphone - UITable view with customise section headers iOS -


i have table view , want display events according time. suppose have 2 events @ 3 pm need section header 3 pm , in 2 rows event title.

enter image description here

in above dummy image there 2 sections (3:00 pm , 7:00 pm)with respective events. , table header date.

i have worked on table view without sections. please me achieve this.

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview{     return how many section need } 

//set section header height

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

//set section view

- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section{     uiview *vw = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.tblimagelist.frame.size.width, 40)];    [vw setbackgroundcolor:[uicolor clearcolor]];    uilabel *lbl = [[uilabel alloc] initwithframe:cgrectmake(0, 0, self.tblimagelist.frame.size.width, 40)];    [lbl settext:@"your text"];    [lbl setbackgroundcolor:[uicolor clearcolor]];    [lbl settextcolor:[uicolor colorwithred:45.0f/255.0f green:206.0/255.0f blue:189.0f/255.0f alpha:1.0f]];    [vw addsubview:lbl];     return vw; 

}


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -