Flip the pull arrow when the settings are open

This commit is contained in:
Cameron Gutman
2018-05-28 12:04:38 -07:00
parent 7df76fcd93
commit b792629943

View File

@@ -41,6 +41,7 @@
int currentPosition;
NSArray* _sortedAppList;
NSCache* _boxArtCache;
UIButton* _pullArrow;
}
static NSMutableSet* hostList;
@@ -492,6 +493,31 @@ static NSMutableSet* hostList;
if (position == FrontViewPositionLeft) {
[(SettingsViewController*)[revealController rearViewController] saveSettings];
}
// Fade out the pull arrow
[UIView animateWithDuration:0.1
animations:^{
self->_pullArrow.alpha = 0.0;
}
completion:^(BOOL finished) {
// Flip the direction of the arrow
if (position == FrontViewPositionLeft) {
// Change the pull arrow back to the default rotation
self->_pullArrow.imageView.transform = CGAffineTransformMakeRotation(0);
}
else {
// Flip the pull arrow when the reveal is toggled
self->_pullArrow.imageView.transform = CGAffineTransformMakeRotation(M_PI);
}
// Fade it back in
[UIView animateWithDuration:0.2
animations:^{
self->_pullArrow.alpha = 1.0;
}
completion:nil];
}];
currentPosition = position;
}
@@ -554,14 +580,14 @@ static NSMutableSet* hostList;
[hostScrollView setShowsHorizontalScrollIndicator:NO];
hostScrollView.delaysContentTouches = NO;
UIButton* pullArrow = [[UIButton alloc] init];
[pullArrow addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchDown];
[pullArrow setImage:[UIImage imageNamed:@"PullArrow"] forState:UIControlStateNormal];
[pullArrow sizeToFit];
pullArrow.frame = CGRectMake(0,
self.collectionView.frame.size.height / 6 - pullArrow.frame.size.height / 2 - self.navigationController.navigationBar.frame.size.height,
pullArrow.frame.size.width,
pullArrow.frame.size.height);
_pullArrow = [[UIButton alloc] init];
[_pullArrow addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchDown];
[_pullArrow setImage:[UIImage imageNamed:@"PullArrow"] forState:UIControlStateNormal];
[_pullArrow sizeToFit];
_pullArrow.frame = CGRectMake(0,
self.collectionView.frame.size.height / 6 - _pullArrow.frame.size.height / 2 - self.navigationController.navigationBar.frame.size.height,
_pullArrow.frame.size.width,
_pullArrow.frame.size.height);
self.collectionView.delaysContentTouches = NO;
self.collectionView.allowsMultipleSelection = NO;
@@ -577,7 +603,7 @@ static NSMutableSet* hostList;
[self updateHosts];
[self.view addSubview:hostScrollView];
[self.view addSubview:pullArrow];
[self.view addSubview:_pullArrow];
}
-(void)dealloc