iphone - UITableView headers on the left side of sections (like Spotlight) -
been searching quite while, , still haven't found way it. i'd reproduce section headers of iphone's spotlight uitableview.
"regular" table view headers stay visible @ top of section when scroll, know. there 1 kind of header i've never seen elsewhere in spotlight page of springboard: there, headers span whole height of section , not stuck on top of section, on left side.
how heck achieved?
good question. made little experiment. looks view spotlight. it's lacking 1 import feature. lower "image" doesn't push upper image top if collide.
i doubt there built in solution without use of private frameworks.
i achieved this:
as can see 2 header images @ top overlap. don't push each other normal headers to. , had deactivate cell separators. if use them appear @ whole cell. have draw them yourself. not big deal.
but have no idea how fix overlapping.
here code made happen:
- (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section { return 1; } - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { uiview *contentview = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.tableview.bounds.size.width, 44)]; contentview.backgroundcolor = [uicolor lightgraycolor]; uiimageview *imageview = [[[uiimageview alloc] initwithframe:cgrectmake(5, 5, 34, 34)] autorelease]; imageview.image = [uiimage imagenamed:[nsstring stringwithformat:@"%d", section]];; [contentview addsubview:imageview]; return [contentview autorelease]; }
Comments
Post a Comment