复杂的多视图iphone ios

时间:2011-03-22 11:40:19

标签: iphone ios multiview

我需要实现一个非常复杂的多视图应用程序,我需要一些建议。多视图应用程序类似于:

第一个视图:普通UIViewController有一个按钮,当我按下它去第二个视图 第二个视图(又名主视图):一个带有标签栏的Windows,其中包含2个标签栏项,可在以下位置切换: 第二个视图A:普通的UIViewController有一些元素 第二个视图B:UITableViewController

有人可以给我一个建议,从哪里开始阅读或一些例子?

THX

2 个答案:

答案 0 :(得分:2)

我的建议是阅读示例代码表单apple,你也可以找到如何运气的编码,或者你可以在堆栈中找到只搜索的示例代码。例如基于导航的应用程序: UINavigationController doesn't work in a the moreNavigationController of a UITabBarController

或简单过渡:

SecondViewController *screen = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
        screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;


        [self presentModalViewController:screen animated:YES];

        [screen release];

希望它有助于再见

wblade

答案 1 :(得分:1)

您需要从基于视图的应用程序开始。然后在appDelegate文件中创建一个UITabbarController。

Appdelegate.h

UITabBarController * tabBarController;
//设置属性

Appdelegate.m

// Synthsize

tabBarController = [[UITabBarController alloc] init];  
    tabBarController.delegate=self;  

//Adding Search,Nearby,Map,AboutUs,Favorites Tabs to tabBarController  
Search * search = [[Search alloc] init];  
UINavigationController *searchNav = [[UINavigationController alloc] initWithRootViewController:search];  

Nearby* nearby = [[Nearby alloc] init];  
UINavigationController *nearbyNav = [[UINavigationController alloc] initWithRootViewController:nearby];  

Map* map = [[Map alloc] init];  
UINavigationController *mapNav = [[UINavigationController alloc] initWithRootViewController:map];  

AboutUs* aboutUs = [[AboutUs alloc] init];  
UINavigationController *aboutUsNav = [[UINavigationController alloc] initWithRootViewController:aboutUs];  

Favorites* favorites = [[Favorites alloc] init];  
UINavigationController *favoritesNav = [[UINavigationController alloc] initWithRootViewController:favorites];  

NSArray* controllers = [NSArray arrayWithObjects:searchNav,nearbyNav,mapNav,aboutUsNav,favoritesNav, nil];  
tabBarController.viewControllers = controllers;  

[window addSubview:tabBarController.view];    

您可以据此管理要在哪个选项卡中放置导航控制器或仅放置视图控制器。

然后在上面提到的每个视图控制器中,你需要实现
- (id)init {}
您可以在其中设置标签名称和图像。