2012-01-26 12 views
3

私はIOS分野の初心者です。私はそれも、4-5ヶ月も経っていないビデオを含む古いチュートリアルに従うのが難しいと感じています。主な理由は、私がxcode 4.2.1で作業していることです。このチュートリアルのほとんどは、以前のバージョンに基づいています。これは、私が取り組むべきいくつかの事例で動かすことを私に任せているようなものです。タブ付きアプリケーションのMainWindow.xib

MainWindow.xibファイルの主な問題は、MainWindow.xibを手作業で再構築する方法のチュートリアルとビデオがあります。私はそれに従って、それを作り直すことができたと言いたい。一方、空のアプリケーション以外で作業する必要がある新しいプロジェクトがあれば、空のアプリケーション用に作成したのと同じ方法でMainWindow.xibファイルを作成しても問題ないですかタブ付きアプリケーション用またはその他のアプリケーション用。

誰かがこれにいくつかの光を投げることができます!

おかげ MAKS

答えて

2

UItabbarを作成するためのコードです。 xcode 4.2.1では、main.xibが作成されていないため、動的に(コード)を適用してタブバーを作成して呼び出す必要があります。

-(void)applicationDidFinishLaunching:(UIApplication *)application { 

    // Add the tab bar controller's current view as a subview of the window 
    tabBarController.delegate=self; 
    tabBarController=[[UITabBarController alloc] init]; 

    mainDashBoard=[[DashBoard alloc] initWithNibName:@"DashBoard" bundle:nil]; 
    mainSearchView=[[SearchView alloc] initWithNibName:@"SearchView" bundle:nil]; 
    mainMoreView=[[MoreView alloc] initWithNibName:@"MoreView" bundle:nil]; 

    UINavigationController *nvCtr0=[[[UINavigationController alloc] init] autorelease]; 
    UINavigationController *nvCtr1=[[[UINavigationController alloc] initWithRootViewController:mainDashBoard] autorelease]; 
    UINavigationController *nvCtr2=[[[UINavigationController alloc] initWithRootViewController:mainSearchView] autorelease]; 
    UINavigationController *nvCtr3=[[[UINavigationController alloc] initWithRootViewController:mainMoreView] autorelease]; 
    UINavigationController *nvCtr4=[[[UINavigationController alloc] init] autorelease];//[[[UINavigationController alloc] initWithRootViewController:nil] autorelease]; 

    tabBarController.viewControllers=[NSArray arrayWithObjects:nvCtr0,nvCtr1,nvCtr2,nvCtr3,nvCtr4,nil]; 

    nvCtr0.tabBarItem.enabled=NO; 
    nvCtr4.tabBarItem.enabled=NO; 

    [window tabBarController.view]; 
} 

あなたのアプリケーションにDasdom thannks

+0

感謝サミュエル – Maks

1

タップバーを使用してアプリケーションを作るには多くの方法があります。私は、コードでタブバーコントローラを作成し、xibと異なるタブに表示されたビューコントローラのインターフェイスを行うことを好みます。しかし時には、コードでインターフェイスを完全に作成するほうが現実的であることがわかります。

AppDelegateUITabBarControllerを割り当てて初期化し、必要なビューコントローラをタブバーコントローラに割り当てます。次に、ウィンドウのrootViewControllerをタブバーコントローラーに割り当てる必要があります。

+0

を実装するために役立つかもしれない....情報について – Maks

関連する問題