how to hide empty rows in a UITableView and change the height of the Uitableview base

Discussion in 'iOS Programming' started by suresh2mv, Nov 18, 2010.

  1. suresh2mv macrumors newbie

    Joined:
    Oct 9, 2010
    #1
    HI friends

    I have couple of problems with my UITableView.

    1. When i add a UITableview on my page, by default it brings up some fixed number of rows. eventhough i set number of rows in section as 1. all the rows appears and except the first row, all are empty rows. So, i want to hide all the empty rows in the UItableview.

    2.Based on the non-empty rows, i want to change the height of my UItableView.

    i have been through web and not finding any proper answers..

    Could someone help me with this, i badly need this.

    thanks suresh
     
  2. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    Just set the hight based on the number of elements in the datasource times however tall your cells are.

    Other options:

    Code:
    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
     --CALCULATE THE HEIGHT OF YOUR OWN CELL HERE RESIZE TABLEVIEW--
    }
    
     

Share This Page