I am making a UITableview that contains CustomCell. My CustomCell contains a UITextView and some other controls, but I want to set My cell height to 300, if my UITextViewtext contains some text, and if my TextView text contains Blank text, then not text, then I want the cell height 170 to be possible. I am writing code for this, but it does not work.
My code is kind of like
NSString *magazineDescription=[self.firstArray valueForKey:@"long_description"];
if([magazineDescription isKindOfClass:[NSString class]])
{
cellOne.magazineDescriptionTextView.text = magazineDescription;
cellOne.frame=CGRectMake(0, 0, 300, 300);
}
else
{
cellOne.magazineDescriptionTextView.text = @"";
cellOne.magazineDescriptionTextView.hidden=TRUE;
cellOne.frame=CGRectMake(0, 0, 300, 170);
}
Here, my self.firstArray contains the JSON data value, and sometimes my keyValue @ "long_description" is zero, so I want to hide the TextView From Cell and Set height of Cell from 300 to 170, and the width should remain the same for both cases.
I know a method for this as:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
, . , .
user4202773