「押したら上と下にひゅっと逃げて、押したらそこからひゅっと出てくるようにして」
「あー、直ぐ出来ます。多分」
「よろしく」
ということで
viewcontroller.m
- (void) showNavigationToolBar {
UINavigationBar *navBar = self.navigationController.navigationBar;
float animationDuration = 0.1;
[self.navigationController setNavigationBarHidden:NO animated:NO];
navBar.frame = CGRectMake(navBar.frame.origin.x,
-navBar.frame.size.height,
navBar.frame.size.width,
navBar.frame.size.height);
[UIView animateWithDuration:animationDuration animations:^{
navBar.frame = CGRectMake(navBar.frame.origin.x,
0,
navBar.frame.size.width,
navBar.frame.size.height);
}];
UIToolbar *toolBar = self.navigationController.toolbar;
CGRect screenRect = [[UIScreen mainScreen] bounds];
float height;
if (UIDeviceOrientationIsPortrait(self.interfaceOrientation))
height = screenRect.size.height;
else
height = screenRect.size.width;
[self.navigationController setToolbarHidden:NO animated:NO];
toolBar.frame = CGRectMake(toolBar.frame.origin.x,
height,
toolBar.frame.size.width,
toolBar.frame.size.height);
[UIView animateWithDuration:animationDuration animations:^{
toolBar.frame = CGRectMake(toolBar.frame.origin.x,
height - toolBar.frame.size.height,
toolBar.frame.size.width,
toolBar.frame.size.height);
}];
}
- (void) hideNavigationToolBar {
UINavigationBar *navBar = self.navigationController.navigationBar;
float animationDuration = 0.1;
[UIView animateWithDuration:animationDuration animations:^{
navBar.frame = CGRectMake(navBar.frame.origin.x,
-navBar.frame.size.height,
navBar.frame.size.width,
navBar.frame.size.height);
} completion:^(BOOL finished) {
[self.navigationController setNavigationBarHidden:YES animated:NO];
}];
UIToolbar *toolBar = self.navigationController.toolbar;
CGRect screenRect = [[UIScreen mainScreen] bounds];
[UIView animateWithDuration:animationDuration animations:^{
toolBar.frame = CGRectMake(toolBar.frame.origin.x,
screenRect.size.height,
toolBar.frame.size.width,
toolBar.frame.size.height);
} completion:^(BOOL finished) {
[self.navigationController setToolbarHidden:YES animated:NO];
}];
}
そんな派手な事はしてないんだけど、あんまし検索しても出てこなかったので備忘録として記載。
にんともかんとも