Skip to content

Instantly share code, notes, and snippets.

@boucher
Created October 15, 2008 04:34
Show Gist options
  • Select an option

  • Save boucher/16857 to your computer and use it in GitHub Desktop.

Select an option

Save boucher/16857 to your computer and use it in GitHub Desktop.
- (void)keyDown:(CPEvent)anEvent
{
var keyCode = [anEvent keyCode];
var index = [[_documentsOutlineView selectionIndexes] firstIndex],
count = [[_documentsOutlineView content] count];
switch(keyCode)
{
case 37: //left
case 38: //up
[_documentsOutlineView setSelectionIndexes:[CPIndexSet indexSetWithIndex:MAX(index-1, 0)]];
break;
case 39: //right
case 40: //down
[_documentsOutlineView setSelectionIndexes:[CPIndexSet indexSetWithIndex:MIN(index+1, count-1)]];
break;
default: [super keyDown:anEvent];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment