Zmienna wysokość TextView w komórce TableView
Mam podstawowyUITableView
, że wypełniam serwis internetowy online, ale nie mogę znaleźć sposobu na ustawienie wysokości moich komórek (dynamicznych liczb komórek) zgodnie z wysokością mojegotextView
.
Oto, jak wypełnię moją komórkę:
UITextView *textView = (UITextView *)[cell viewWithTag:106];
textView.text = [[stories objectAtIndex:indexPath.row] objectForKey:@"texte"];
w moimcellForRow
metody:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Próbowałem tego, ale mam błądEXC_BAD_ACCESS
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PerleCell"];
UITextView *textView = (UITextView *)[cell viewWithTag:106];
textView.text = [[stories objectAtIndex:indexPath.row] objectForKey:@"texte"];
CGFloat *heightCell = (CGFloat*)textView.text.length;
return *heightCell;
}