Ios 将选项卡栏控制器放置在viewcontroller的顶部
如何将TABBAR控件放置在视图控件的顶部。默认情况下,它位于底部。如何将其放置 使用以下代码执行以下操作:Ios 将选项卡栏控制器放置在viewcontroller的顶部,ios,iphone,uitabbarcontroller,Ios,Iphone,Uitabbarcontroller,如何将TABBAR控件放置在视图控件的顶部。默认情况下,它位于底部。如何将其放置 使用以下代码执行以下操作: UIImage* tabBarBackground = [UIImage imageNamed:@"footer-bg.png"]; [[UITabBar appearance] setBackgroundImage:tabBarBackground]; [[UITabBar appearance]setSelectionIndicatorImage:[UIImage imageNam
UIImage* tabBarBackground = [UIImage imageNamed:@"footer-bg.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance]setSelectionIndicatorImage:[UIImage imageNamed:@"footer-hover-bg.png"]];
if(IS_IOS_7)
{
[[appDelegate.tabBarController tabBar] setSelectionIndicatorImage:[UIImage imageNamed:@"footer-hover-bg.png"]];
[[UITabBar appearance] setTintColor:[UIColor blackColor]];
}
appDelegate.tabBarController.tabBar.frame = CGRectMake(0, 20, 320, 50);
appDelegate.tabBarController.delegate=self;
UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, -20, 320, 600)];
viewControllers = [[NSMutableArray alloc] init];
MainViewController *view1 = [[MainViewController alloc] init];
UINavigationController *nav1=[[UINavigationController alloc]initWithRootViewController:view1];
[viewControllers addObject:nav1];
ViewController1 *view2 = [[ViewController1 alloc] init];
UINavigationController *nav2=[[UINavigationController alloc]initWithRootViewController:view2];
[viewControllers addObject:nav2];
[appDelegate.tabBarController setViewControllers:viewControllers];
appDelegate.tabBarController.tabBarController.view.frame=CGRectMake(0, 0, 320, 480);
[view addSubview:appDelegate.tabBarController.view];
[self.view addSubview:view];
UITabBarItem *tabBarItem1 = [appDelegate.tabBarController.tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [appDelegate.tabBarController.tabBar.items objectAtIndex:1];
[tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:[arraySelectedImages objectAtIndex:0]] withFinishedUnselectedImage:[UIImage imageNamed:[arrayUnselectedImages objectAtIndex:0]]];
[tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:[arraySelectedImages objectAtIndex:1]] withFinishedUnselectedImage:[UIImage imageNamed:[arrayUnselectedImages objectAtIndex:1]]];
如何使用故事板执行相同操作?首先添加
UIViewController
,然后添加UIAbbar
,如果使用autolayout,则添加Controint
不要忘记连接代理
希望这会有所帮助。首先添加一个
UIViewController
,然后添加uitabar
,如果使用autolayout,则添加约束
不要忘记连接代理
希望这会有所帮助。首先添加一个
UIViewController
,然后添加uitabar
,如果使用autolayout,则添加约束
不要忘记连接代理
希望这会有所帮助。首先添加一个
UIViewController
,然后添加uitabar
,如果使用autolayout,则添加约束
不要忘记连接代理
希望这会有所帮助。我已经使用了UITabBarController并为其添加了视图。我是否可以更改其框架以便将其添加到上面。否。如果您使用UITabBarController,您将无法更改位置。请给我使用故事板的Tabbar的示例链接。我找不到:(开头:非常感谢:)。如何将第一个视图控制器与stroyboard中的第一个tabbaritem连接?。我无法加载视图控制器。我已使用UITabBarController并向其添加了视图。我是否可以更改其框架以便将其添加到上面。否。如果您使用UITabBarController,您将无法更改位置。请给我使用故事板的Tabbar的示例链接。我找不到:(开头:非常感谢:)。如何将第一个视图控制器与stroyboard中的第一个tabbaritem连接?。我无法加载视图控制器。我已使用UITabBarController并向其添加了视图。我是否可以更改其框架以便将其添加到上面。否。如果您使用UITabBarController,您将无法更改位置。请给我使用故事板的Tabbar的示例链接。我找不到:(开头:非常感谢:)。如何将第一个视图控制器与stroyboard中的第一个tabbaritem连接?。我无法加载视图控制器。我已使用UITabBarController并向其添加了视图。我是否可以更改其框架以便将其添加到上面。否。如果您使用UITabBarController,您将无法更改位置。请给我使用故事板的Tabbar的示例链接。我找不到:(开头:非常感谢:)。如何将第一个视图控制器与stroyboard中的第一个tabbaritem连接?我无法加载视图控制器。