ios - UITableViewCell Repeating UIView -
i facing small issue , em banging head being not able solve it…
i have uitableview
custom uitableviewcell
.. cell's height determined on size of text. when user taps it, text translated , translated text appended in new line. making them separated, add uiview lineview
width as cell's label , height = 1
uiview *lineview = [[uiview alloc] initwithframe:cgrectmake(bubbleframe.origin.x, bubbleframe.origin.y + bubbleframe.size.height/2, bubbleframe.size.width, 1)]; lineview.backgroundcolor = [uicolor whitecolor]; lineview.tag = indexpath.row; [cell addsubview:lineview];
everything works fine when navigate viewcontroller
see lineview
misplaced on each cell..
cant understand why doing that..
any appreciated.. in advance..
well after working on advice of mustafa ibrahim, found question had similar problem … intropedro's answer problem solved :)
added dequeuereusablecellwithidentifier
if (cell == nil) { cell = [[chatcustomcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } else{ [[cell.contentview viewwithtag:500] removefromsuperview]; }
and changed lineview code bit too..
uiview *lineview = [[uiview alloc] initwithframe:cgrectmake(bubbleframe.origin.x, bubbleframe.origin.y + bubbleframe.size.height/2, bubbleframe.size.width, 1)]; lineview.backgroundcolor = [uicolor whitecolor]; lineview.tag = indexpath.row; [cell addsubview:lineview];
Comments
Post a Comment