Last active
March 15, 2016 14:35
-
-
Save karlwhite/294523ee2842dc7fc60a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator { | |
switch( tableView.tag ) { | |
case InboxTable_Folders: { | |
// Expand folders | |
self.folderWidth.constant = FOLDERS_OPEN; | |
self.threadWidth.constant = THREADS_OPEN; | |
[self.view setNeedsLayout]; | |
[self.view setNeedsUpdateConstraints]; | |
[UIView animateWithDuration:0.35 delay:0 usingSpringWithDamping:0.75 initialSpringVelocity:0.05 options:UIViewAnimationOptionCurveLinear|UIViewAnimationOptionBeginFromCurrentState animations:^{ | |
[self.view layoutIfNeeded]; | |
[self.mailPreviewContainer zoomToRect:CGRectMake(0, 0, MIN_PREVIEW_WIDTH, 1) animated:NO]; | |
} completion:nil]; | |
break; | |
} | |
case InboxTable_Threads: { | |
// Collapse folders | |
if ( context.previouslyFocusedView != self.mailPreview ) { | |
if ( context.previouslyFocusedView.superview != context.nextFocusedView.superview ) { | |
self.folderWidth.constant = FOLDERS_COLLAPSED; | |
self.threadWidth.constant = THREADS_OPEN; | |
[self.view setNeedsLayout]; | |
[self.view setNeedsUpdateConstraints]; | |
[UIView animateWithDuration:0.35 delay:0 usingSpringWithDamping:0.75 initialSpringVelocity:0.05 options:UIViewAnimationOptionCurveLinear|UIViewAnimationOptionBeginFromCurrentState animations:^{ | |
[self.view layoutIfNeeded]; | |
[self.mailPreviewContainer zoomToRect:CGRectMake(0, 0, MIN_PREVIEW_WIDTH, 1) animated:NO]; | |
} completion:nil]; | |
} | |
} | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment