I am creating dynamic cell as mentioned in image. How can I make dynamic cell in table view.
code
self.arrayContainer = [[NSMutableArray alloc]initWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"H.Rackham",@"name",
@"20/7/1994",@"date",
@"Lorem ipsum dolor sit amet, qui ex blandit posidonium efficiantur, sed te veri bonorum. Per id iriure utroque docendi. Stet patrioque incorrupte ea nam. Prima molestie accommodare nam in, inermis omnesque vix cu. Est posse suavitate eu, ei justo labitur necessitatibus has, no sea agam liber. Deseruisse elaboraret eu ius. Est verterem sententiae an. Prompta elaboraret duo cu, aperiam dolorem has an, ubique nominati comprehensam no pri. In autem scripta concludaturque cum.",@"Description",nil],
[NSDictionary dictionaryWithObjectsAndKeys:
@"Sophia Rhodes",@"name",
@"20/7/1994",@"date",
@" Deseruisse elaboraret eu ius. Est verterem sententiae an. Prompta elaboraret duo cu, aperiam dolorem has an, ubique nominati comprehensam no pri. In autem scripta concludaturque cum.",@"Description",
nil],
nil];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.arrayContainer count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
cell.textLabel.text = [[self.arrayContainer objectAtIndex:indexPath.row ]valueForKey:@"name"];
cell.detailTextLabel.text = [[self.arrayContainer objectAtIndex:indexPath.row ]valueForKey:@"date"];
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewAutomaticDimension;
}
Image
I have made simple code demo. now I want this type of functionality.
1)Name and date should be display differently as mentioned in image.
2)According to content cell should be resize.
Thank you