I’ve got a scroll view, with 2 UITables on it.
Everything about the table work well. Neither of the tables need to scroll themselves.
If I call
[self.tableOne reloadData]; when a button is pressed it works. But when I call it in a delegate method of UITextView it does not action. Is this some threading issue? Or what is causing this bizarre behavior.
I want to increase the size of a TableCell when the user presses on UITextView thats in each cell.
I added a NSLog here to confirm that this method is getting called.
- (void)textViewDidBeginEditing:(UITextView *)textView
{
theTableCellCurrentlyBeingEdited = textView.tag;
[self.tableOne reloadData];
}
Gets touched I note which cell is active, and call reload table so I can adjust the height of this cell in
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath
{
if (theTableCellCurrentlyBeingEdited == indexPath.row)
{
return 120;
}
else
{
return TABLE_CELL_HEIGHT;
}
}
But heightForRowAtIndex never gets called.
I have tableOnes datasource and delegate set to self.
In my .h I have added
<UITextViewDelegate, UITableViewDelegate, UITableViewDataSource>
So the calls are getting here.
Anybody able to give me some advice as to what is going wrong?
Many Thanks,
-Code
First of all. Where do you call the text of the textView?
You are using
theTableCellCurrentlyBeingEdited = textView.tag;And the tag will not give you the text you entered. You are just changing the tag of your cell which won’t change a thing to the visuals of the cell.
Second. Why not call:
or
So that in the first delegate method your cell gets updated every char you write and in the second you are sure the user is done writing in the textview?