ios - Two rows only UITableView -
i'm using uitableview control on nib 1 section , set delegate/data source controller "table data" array initialized 2 items only. however, i'm seeing additional empty rows being rendered in table view when run in simulator. how can make uitableview render 2 rows?
thanks!
i having similar problem, how show separators cells contain data. tableview renders many rows can fit area allocated (width , height). number designate in numberofrowsinsection used determine how many times should call cellforrowatindexpath.
to overcome the rendering of separator lines empty cells did following:
disable separators whole tableview. can in inspector tableview in interface builder or calling
[yourtableview setseparatorstyle:uitableviewcellseparatorstylenone];.inside
cellforrowatindexpathpopulate tableview cells create newuiview, set subview cell. have background of view lightgray , transparent. can following:uiview *separatorview = [[uiview alloc] initwithframe:cgrectmake: (0, cell.frame.size.height-1, cell.frame.size.width, 1)]; [separatorview setbackgroundcolor:[uicolor lightgraycolor]]; [separatorview setalpha:0.8f]; [cell addsubview:separatorview];the width of view 1 pixel same default separator, runs length of cell, @ bottom.
since cellforrowatindexpath called have specified in numberofrowsinsection these subviews created cells possess data , should have separator.
hope helps.
Comments
Post a Comment