Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Two different custom cells

    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 209
    Comment on it

    Hi all, If you want to add two different xibs in a tableView you can check out the code here.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (tableView==carTable)
        {
            ReviewModel *reviewObject=[dictArray objectAtIndex:indexPath.row];
    
    
            static NSString *CellIdentifier = @"ReviewCell";
            cell = (ReviewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            cell = nil;
            BOOL noImage = reviewObject.photo.length == 0;
    
            if (cell == nil) {
                 NSArray *nib = [[NSBundle mainBundle]loadNibNamed:noImage?@"SearchCellWithoutImage":@"ReviewCell" owner:self options:nil];
                 cell = [nib objectAtIndex:0];
            }
    
            if (!noImage) {
    // code for one xib (function calls)
            }else
            {
    // code for other xib(function calls)
    
    
    
            }
            return cell;
            }
    
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: