objective c - I want to create custom table view separator with UIlabel lying between two table view cells, like the calendar app of the iOS -


enter image description here

how achieve this?

i tried adding separator view explictly, creating uiview, adding label on it, this, in cellforrowatindexpath, add views

 uiview *timelabelplusseparator = [[uiview alloc] initwithframe:cgrectmake(0, 0, cell.contentview.frame.size.width+200, 1)];  uilabel *timelabel = [[uilabel alloc] initwithframe:cgrectmake(0, cellrect.origin.y -6, 45, 12)]; 

and adding time label on timelabelplusseparator subview, , cell.contentview

what happens here is, show on top of cell, want in mid of 2 cell, calendar.

if add on tableview, instead of cell, than, cells earlier not visible, create problem,

they show this

enter image description here

can point out problem here. yes, my cells reused.

the thing here is, want use table view only, have implement swipe delete, more, etc also. creating different view can take lot of time , effort.

the earlier approach @nick partially working,but there problems in calendar, there top , bottom margin in content on cell. because shifting separator, cell still there.

what wanted show button lying on whole cell. achieve ugly thing, since lower cell hid button previous cell. bottom of button hiding behind lower cell

i did try bring button in front of views, using bringsubviewtofront:, taking care of hierarchy, come on top of table view , appear properly, didn't help.

ended using workaround, adding separate uiscrollview time label, since table view used static.

so able achieve time label in center there 2 different scrollviews, tableview , other scrollview.

made both of them follow each others' scroll changing content offset properly, in uiscrollview delegate method.

-(void)scrollviewdidscroll:(uiscrollview *)scrollview{  if([scrollview isequal:self.timelabelscrollview]) {     cgpoint offset = self.firsttableviewwithouttime.contentoffset;     offset.y = self.timelabelscrollview.contentoffset.y;     [self.firsttableviewwithouttime setcontentoffset:offset]; } else {     cgpoint offset = self.timelabelscrollview.contentoffset;     offset.y = self.firsttableviewwithouttime.contentoffset.y;     [self.timelabelscrollview setcontentoffset:offset]; } 

}

not approach, works, had manage tap on centre of cell only, no problem tapping on timelabelscrollview not firing didselectforrowatindexpath: method. can handled adding gesture recogniser if need arises.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -