我有单独的自定义UITableViewCell显示数据(这些数据来自服务器JSON响应).在每个UITableViewCell我有按钮阅读更多.如果用户点击阅读更多按钮我想以编程方式添加从服务器UILabel显示其他信息.但最初我设置UITableViewCell高度所以点击阅读更多按钮后,我无法看到额外的信息UILabel..
这是屏幕截图:

这是我需要的屏幕:

这是我使用的以下编码:
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
int height1;
if(readMore){
height1=200;
NSLog(@"Clicked");
}
else{
height1=100;
NSLog(@"Not clicked");
}
return height1; // Normal height
}
-(NSInteger) tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
return [TitleArr count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
static NSString *simpleTableIdentifier = @"SimpleTableCell_iPad";
cell = (TableCell_Leads *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
}
else{
static NSString *simpleTableIdentifier …Run Code Online (Sandbox Code Playgroud)