How to set the the height of cell progamatically without using nib file ?
- by srikanth rongali
This is my program
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.title = @"Library";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleBordered target:self action:@selector(close:)];
// self.tableView.rowHeight = 80;
}
-(void)close:(id)sender
{
//
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{ cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
UILabel *dateLabel = [[UILabel alloc]init];
dateLabel.frame = CGRectMake(85.0f, 6.0f, 200.0f, 20.0f);
dateLabel.tag = tag1;
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
cell.contentView.frame = CGRectMake(0.0f, 0.0f, 320.0f, 80.0f);
[cell.contentView addSubview:dateLabel];
[dateLabel release];
}
// Set up the cell...
//[(UILabel *)[cell viewWithTag:tag1] setText:@"Date"];
cell.textLabel.text = @"Date";
return cell;
}
I am setting the frame size of cell in tableView: but the cell is in default size only. I mean the height I set was 80 but it was not set as 80 height.
How can I make it.
Thank You