I have a UITextView included in a UITableViewCell. The layout is correct when the views are initially displayed, but once I click in the UITextView it DOES NOT automatically scrolls up and the whole UITextView becomes invisible.
This image is when the UITextView is not active:
http://img13.imageshack.us/img13/3894/unloaded.png
And this one is when I clicked in the UITextView to make it active:
img337.imageshack.us/img337/2583/loaded.png (Put “http://” before the link, I can’t post more than one Hyperlink)
I want the cell with the UITextView to scroll up. How can I achieve this?
Any suggestions are appreciated.
Julio Cezar
I’ve already done it. My solution is not the best but it works very well: everything happens on tableView:cellForRowAtIndexPath:
1) For every cell that has a UITextView I have a NSDictionary: I save all my UITextView’s on the cells on NSDictionary with a particular key.
2) And I also have another NSDictionary with the indexPath objects that are created in tableView:cellForRowAtIndexPath. If a cell A has UITextView A, they will have the same key in the NSDictionaries.
3) I implement the UITextViewDelegate and call textViewDidBeginEditing: here is my code:
NSArray *keys = [self.answersDic allKeysForObject:textField];
id *key = (id *)[keys objectAtIndex:0];
NSIndexPath *tempIndex=[self.indexPathForViews objectForKey:key];
[tableViewLocal scrollToRowAtIndexPath:tempIndex atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
OBSERVATIONS:
a) answersDic is the NSDictionary where my UITextViews are saved.
b) indexPathForViews is the NSDictionary where my IndexPaths are saved.
c) the most important part of this code: the method, that brings the view to scroll up:
[tableViewLocal scrollToRowAtIndexPath:tempIndex atScrollPosition:UITableViewScrollPositionTop animated:YES];
So, thats it. Thanks for your help!