標籤:ios 經典筆記 原創珍藏
iOS 中主tab(含有5個視圖) 切換到次級tab(含有另外五個視圖) 的使用方法:
-(void)makeTabBarHidden:(BOOL)hide
{
if ( [self.rootTabBarController.view.subviewscount] < 2 ) {
return;
}
UIView *contentView;
if ( [[self.rootTabBarController.view.subviewsobjectAtIndex:0]isKindOfClass:[UITabBarclass]] ) {
contentView = [self.rootTabBarController.view.subviewsobjectAtIndex:1];
}else {
contentView = [self.rootTabBarController.view.subviewsobjectAtIndex:0];
}
if (hide) {
contentView.frame =self.rootTabBarController.view.bounds;
}
else {
contentView.frame =CGRectMake(self.rootTabBarController.view.bounds.origin.x,
self.rootTabBarController.view.bounds.origin.y,
self.rootTabBarController.view.bounds.size.width,
self.rootTabBarController.view.bounds.size.height - self.rootTabBarController.tabBar.frame.size.height);
}
self.rootTabBarController.tabBar.hidden = hide;
}
iOS 中一個tabBarController 切換到另一個tabBarController的實現方法