I am very new to iPhone Development. I am fetching data from the table and putting it onto the UITableViewCell. But sometimes this data is very small and sometimes may be large. According to the data size I need to manage the height of cell and data is displayed properly in a cell with multiline if it doesn't fit to single line. Is there any other option for me instead of UITableView or I am in Right way. If yes then how should I proceed?
Asked
Active
Viewed 262 times
0
-
possible duplicate of [Different height for alternative cell in UITableView](http://stackoverflow.com/q/3529246/) – outis Jul 14 '12 at 20:22
2 Answers
3
use this delegate it will increase the row size
-(CGFloat)tableView :(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80; //value can be changed depending, how much height you need.
}

Ajeet Pratap Maurya
- 4,244
- 3
- 28
- 46
-
@Ravi if this answer is correct then can you pls click on the tick on left side. thank you – Ajeet Pratap Maurya Nov 14 '11 at 16:15
0
A UITableView
is ok for you. In your UITableViewDelegate, you can use
– tableView:heightForRowAtIndexPath:
to set the row height. Now, if your data is displayed correctly or not, it depends on the content you are managing in the table view cell. UITextField
is intrinsically one-line; but you could try with UITextView
.
Otherwise, if you are looking for more advanced possibilities, have a look at this tutorial about customizing cell view content.
Have a look at this S.O. topicenter link description here for a snippet of code about calculating the size of string.
-
But how I know that how much data is coming from database field and if needed to show it in multiline? – Ravi Nalawade Nov 14 '11 at 14:23