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:

  1. disable separators whole tableview. can in inspector tableview in interface builder or calling [yourtableview setseparatorstyle:uitableviewcellseparatorstylenone];.

  2. inside cellforrowatindexpath populate tableview cells create new uiview , 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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -