When empty field comes, removed the row in the Grouped Table view in iPhone?

Posted by Pugal Devan on Stack Overflow See other posts from Stack Overflow or by Pugal Devan
Published on 2011-01-25T11:56:59Z Indexed on 2011/02/01 7:25 UTC
Read the original article Hit count: 154

Filed under:
|

Hi friends,

I have displayed the datas in grouped table view. The data's are displayed in the table view from XML parsing. I have 2 section of the table view, the section one has three rows and section two has two rows.

  section 1 ->  3 Rows

  section 2 - > 2 Rows.

Now i want to check, if anyone of the string is empty then i should remove the empty cells, so i have faced some problems, if i have removed any empty cell, then it will changed the index number. So how can i check, anyone of the field is empty?, Because some times more number of empty field will come, so that the index position will be change. So please send me any sample code or link for that? How can i achieve this?

Sample code,

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section       
 {

 if (section == 0) {

    if([userEmail isEqualToString:@" "] || [phoneNumber isEqualToString:@" "] || [firstName isEqualToString:@" "])
    {
        return 2;

    } 

    else {

        return 3;

    }
}
if (section == 1) {

       if(![gradYear isEqualToString:@" "] || ![graduate isEqualToString:@" "]) {

    return 1;
}
    else
   {
        return 2;
     }


return 0;

}

Please Help me out!!!

Thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about grouped-table