How to make a alternate cel开发者_JAVA技巧l with a different height?
I need height for cell1 is 60 and cell2 is 30....
how can i do this?
Thanks in advance.
you can set the height of cell from the delegate method of table view
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
     if (indexPath.row==0)
     {
        return 60;
     }
     else if(indexPath.row==1)
     {
        return 20;
     }
}
and so on....
Happy coding....
Use the modulus operator and you dont need an if case for every row index :)
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
     if (indexPath.row % 2 == 0)
     {
        return 60;
     }
     else
     {
        return 30;
     }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论