Create tableview and design it in CustomTableCell Name,code,continent,population line etc. and got the values from web web services united states,usa,989898,north America etc. In CustomTableCell design it. my problem name should be a canada means code and continent want to hide and display population:979797 and height should be reduse. next mexico means want to display all values.china and afghanistan values should be code, continent hide. Population: Want to display. how is possible help.(My doubt: In tableview cell create a one label it display in all cell how to hide and display in each cell).help me. what want to do in cellforrow in heighforrow .Ple see the screen here.than Advance.
Yes,it is possible.You have to apply condition based on the country name in the method cellForRowAtIndexPath
. Like this
if(countryName isEqualToString @"Canada"){
countryInfoLabel.numberofLines=0;
countryInfoLabel.text=[NSString stringWithFormat:@"Population:%@",populationFromService]];
}
Insert the information in the label countryInfoLabel
based on the country name and display it accordingly. use \n
to move to next line in countryInfoLabel
.
And to change the height of the cell dynamically use the heightForRowAtIndexPath
Use the following code
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return (countryName.frame.origin.height+countryInfoLabel.frame.origin.height);
}
Hope it will work.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments