Improve CPTokenField autocomplete scrolling.

This commit is contained in:
Alexander Ljungberg committed 2012-06-16 12:31:48 +01:00
1 parent 0ef03d31b8
commit feaf9c6f20
1 file changed
+3 -6
+3 -6
View File
@@ -356,6 +356,8 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
- (BOOL)resignFirstResponder
{
CPLog("%@ resignFirstResponder", self);
if (_preventResign)
return NO;
@@ -1199,12 +1201,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
- (void)setIndexOfSelectedItem:(int)anIndex
{
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:anIndex] byExtendingSelection:NO];
var clipView = [scrollView contentView],
rowRect = [tableView rectOfRow:anIndex];
if (rowRect && !CPRectContainsRect([clipView bounds], rowRect))
[clipView scrollToPoint:rowRect.origin];
[tableView scrollRowToVisible:anIndex];
}
- (int)indexOfSelectedItem