[tvOS] Clean up and document parts of code.

This commit is contained in:
Aaron Schubert
2016-02-25 09:06:11 +00:00
parent 3d6f6766e9
commit f9bf402047
4 changed files with 95 additions and 501 deletions

View File

@@ -89,7 +89,7 @@ void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, v
- (void)didLoad
{
#if TARGET_OS_TV
// [self addTarget:self action:@selector(updateUI) forControlEvents:ASControlNodeEventPrimaryActionTriggered];
//On tvOS all control views, such as buttons, interact with the focus system even if they don't have a target set on them. Here we add our own internal tap gesture to handle this behaviour.
self.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGestureRec = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pressDown)];
tapGestureRec.allowedPressTypes = @[@(UIPressTypeSelect)];
@@ -162,7 +162,6 @@ void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, v
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"Touches Cancelled");
// If we're not interested in touches, we have nothing to do.
if (!self.enabled)
return;
@@ -464,6 +463,7 @@ void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, v
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
//FIXME: This is never valid inside an ASCellNode
if (context.nextFocusedView && context.nextFocusedView == self.view) {
//Focused
[coordinator addCoordinatedAnimations:^{