自定义选项卡我不知道我怎么会能够设计自己的自定义选项卡,点击即可以在屏幕上显示多发视图时显示使用中的UIViewController
http://tinypic.com/r/2cxtjk7/5
我只是多个视图目前能够找到底部的标签条方法。感谢您的帮助IM相当新的还是那么如果你能详细介绍一下,这将是巨大的:)
自定义选项卡我不知道我怎么会能够设计自己的自定义选项卡,点击即可以在屏幕上显示多发视图时显示使用中的UIViewController
http://tinypic.com/r/2cxtjk7/5
我只是多个视图目前能够找到底部的标签条方法。感谢您的帮助IM相当新的还是那么如果你能详细介绍一下,这将是巨大的:)
显示多个视图中使用自定义选项卡
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
{
AccountViewController *accountViewController = [[AccountViewController alloc]
initWithNibName:@"AccountViewController" bundle:nil];
MoreViewController *moreViewController = [[MoreViewController alloc]
initWithNibName:@"MoreViewController" bundle:nil];
BarTabViewController *barTabViewController = [[BarTabViewController alloc]
initWithNibName:@"BarTabViewController" bundle:nil];
LocationsViewController *locationsViewController = [[LocationsViewController alloc]
initWithNibName:@"LocationsViewController" bundle:nil];
self.viewControllers = [NSArray arrayWithObjects:locationsViewController, accountViewController,
barTabViewController, moreViewController, nil];
[self.view addSubview:locationsViewController.view];
self.selectedController = locationsViewController;
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.selectedIndex = 0;
self.tabBarController.viewControllers = [NSArray arrayWithObjects:locationsViewController, accountViewController,
barTabViewController, moreViewController, nil];
self.tabBarController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.navigationController pushViewController:delegate.tabBarController animated:YES];
return self;
}
就像我说的,这将显示所选控制器正确的,但是当应用程序启动,我尝试切换视图与标签栏,刚刚成为灰色子视图...以下是转换项目代码:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if (item == locationsTabBarItem) {
UIViewController *locationsController = [viewControllers objectAtIndex:0];
[self.selectedController.view removeFromSuperview];
[self.view addSubview:locationsController.view];
self.selectedController = locationsController;
}
else if (item == accountsTabBarItem) {
UIViewController *accountsController = [viewControllers objectAtIndex:1];
[self.selectedController.view removeFromSuperview];
[self.view addSubview:accountsController.view];
self.selectedController = accountsController;
}
else if (item == barTabTabBarItem) {
UIViewController *barTabController = [viewControllers objectAtIndex:2];
[self.selectedController.view removeFromSuperview];
[self.view addSubview:barTabController.view];
self.selectedController = barTabController;
}
else {
UIViewController *moreController = [viewControllers objectAtIndex:3];
[self.selectedController.view removeFromSuperview];
[self.view addSubview:moreController.view];
self.selectedController = moreController;
}
}
我在视图中添加东西做负载结束这里:
PatientDetailsViewController * patientDetailsView = [[PatientDetailsViewController的alloc] initWithNibName:@ “PatientDetailsViewController” 束:无]; [self addChildViewController:patientDetailsView]; [self.patientDetailsView addSubview:patientDetailsView.view]; [self.patientDetailsView setClipsToBounds:YES];
然后使用动画调整视图帧大小,然后使用按钮对其打开动画。
我做了同样的事情,但我不确定我该如何解释整件事情,但如果您在做这件事时遇到了一些问题,我可以帮助您。 – 2013-10-15 09:47:12