2017-03-25

tabbar隐藏带来的坑,


- (void)hidesTabBar:(BOOL)yesOrNO animated:(BOOL)animated

{

self.tabBarHidden= yesOrNO;

if(yesOrNO ==YES)

{

if(self.tabBarView.frame.origin.y==self.view.frame.size.height)

{

return;

}

}

else

{

if(_tabBarView.frame.origin.y==self.view.frame.size.height-kTabBarHeight)

{

return;

}

}

if(animated ==YES)

{

[UIViewbeginAnimations:nilcontext:NULL];

[UIViewsetAnimationDuration:0.3f];

if(yesOrNO ==YES)

{

_tabBarView.frame=CGRectMake(_tabBarView.frame.origin.x,_tabBarView.frame.origin.y+kTabBarHeight,_tabBarView.frame.size.width,_tabBarView.frame.size.height);

}

else

{

_tabBarView.frame=CGRectMake(_tabBarView.frame.origin.x,_tabBarView.frame.origin.y-kTabBarHeight,_tabBarView.frame.size.width,_tabBarView.frame.size.height);

}

[UIViewcommitAnimations];

}

else

{

[UIViewbeginAnimations:nilcontext:NULL];

[UIViewsetAnimationDuration:0.3f];

if(yesOrNO ==YES)

{

_tabBarView.frame=CGRectMake(_tabBarView.frame.origin.x,_tabBarView.frame.origin.y+kTabBarHeight,_tabBarView.frame.size.width,_tabBarView.frame.size.height);

}

else

{

_tabBarView.frame=CGRectMake(_tabBarView.frame.origin.x,_tabBarView.frame.origin.y-kTabBarHeight,_tabBarView.frame.size.width,_tabBarView.frame.size.height);

}

[UIViewcommitAnimations];

}

}

你可能感兴趣的:(2017-03-25)