void hidePanel if self transform tx self hidePanelButton transform CGA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
- (void)hidePanel {
if (self.transform.tx != 0.f) {
self.hidePanelButton.transform = CGAffineTransformMakeTranslation(NAVIGATION_MENU_WIDTH, 0.f);
[self addSubview:self.hidePanelButton];
}
[UIView animateWithDuration:ANIMATION_DURATION animations:^{
if (self.transform.tx == 0.f) {
self.transform = CGAffineTransformMakeTranslation(-NAVIGATION_MENU_WIDTH, 0.f);
self.hidePanelButton.transform = CGAffineTransformMakeTranslation(NAVIGATION_MENU_WIDTH, 0.f);
[self.hidePanelButton setImage:[UIImage imageNamed:@"hidePanelHighlightedIcon.png"] forState:UIControlStateNormal];
} else {
self.transform = CGAffineTransformIdentity;
self.hidePanelButton.transform = CGAffineTransformIdentity;
}
} completion:^(BOOL finished) {
if (self.transform.tx == 0.f) {
[self.hidePanelButton setImage:[UIImage imageNamed:@"hidePanelIcon.png"] forState:UIControlStateNormal];
} else {
self.hidePanelButton.transform = CGAffineTransformIdentity;
[self.delegate.view addSubview:self.hidePanelButton];
}
}];
}