table

tbl.estimatedRowHeight = 100.0;
// tbl.rowHeight = UITableViewAutomaticDimension;

//
// ViewController.m
// tbl_cell_height
//
// Created by Devlon on 6/22/15.
// Copyright (c) 2015 Devlon. All rights reserved.
//

#import “ViewController.h”
@interface ViewController ()
{
NSIndexPath *selectedCellIndexPath;
int t;
int selectedNumber;
NSIndexPath *_expandIndexPath;
}
@end

@implementation ViewController

– (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

– (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10.
;
}

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@”c1″];
if (cell == nil)
{
cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@”c1″];
}
return cell;
}

– (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([indexPath isEqual:_expandIndexPath])
return 80;

return 44;
}

– (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

// NSMutableArray *modifiedRows = [NSMutableArray array];
// // Deselect cell
// [tableView deselectRowAtIndexPath:indexPath animated:TRUE];
// _expandIndexPath = indexPath;
// [modifiedRows addObject:indexPath];
//
// // This will animate updating the row sizes
// [tableView reloadRowsAtIndexPaths:modifiedRows withRowAnimation:UITableViewRowAnimationAutomatic];
}

@end

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s