私は自分のアプリに適切なビュー階層を作成する方法を理解しようと少し読んでいます。arcを使用してxcode4.2でベースのTabbedアプリケーションを作成しましたが、この新しいアプリにはmainwindow.xibが含まれていないため、IBを使用するチュートリアルの多くは私には役に立ちません。私はすでに5タブのアプリケーションを動作させており、アプリの「ベース」は期待どおりに動作しています。私が必要としているのは、現在表示されている特定の「タブ付き」ウィンドウ内により多くのビューを組み込むことです。私の階層は以下のように単純です。基本カテゴリが5つしかないため、推測に疑問符が追加されます。現在、すべてのUIViewControllerはtabBarController内にあります。
アプリの階層(提案)
Home (Currently UIViewController using homeViewController, convert to UINavigationController?)
Add (UIViewController with HomeAdd.xib?)
Edit (UIViewController with HomeEdit.xib
delete (UIViewController with HomeDelete.xib?)
ViewList - Single page to view list (Currently UIViewController using viewListViewController)
Share - Single page to send emails / invites (Currently UIViewController using shareViewController)
Friends (UINavigationController with root view of FriendsRoot.xib?)
Add (UIViewController with FriendsAdd.xib?)
Edit (UIViewController with FriendsEdit.xib?)
delete (UIViewController with FriendsDelete.xib?)
Settings - Single page for app settings/preferences (Currently UIViewController using settingsViewController)
上記の階層が可能かどうか(つまり、tabBarController内でビューコントローラーを混合すること)もわかりません。これは、mainwondiwがないため、アプリデリゲート内の唯一のオプションであると思われるため、プログラムでこれを実現する方法について入力してください。デフォルトではh/m/xib。
アプリデリゲート内のこれに関する現在のコードは次のとおりです。
AppDelegate.h
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UITabBarController *tabBarController;
@end
AppDelegate.m
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *homeViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
UIViewController *viewListViewController = [[ViewListViewController alloc] initWithNibName:@"ViewListViewController" bundle:nil];
UIViewController *shareViewController = [[ShareViewController alloc] initWithNibName:@"ShareViewController" bundle:nil];
UIViewController *friendsViewController = [[FriendsViewController alloc] initWithNibName:@"FriendsViewController" bundle:nil];
UIViewController *settingsViewController = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
[self.tabBarController setDelegate:self];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:homeViewController, viewListViewController, shareViewController, friendsViewController, settingsViewController, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
UINavigationControllers、またはカスタムボタンを使用した代替ビューを挿入する試みを数回試みましたが、コンテキストとコードをまだ学習しているため、すべて失敗したビルドになるようです。
どんなアドバイスも高く評価されます。これまでの投稿では、これまでのところ限られた成功しか収めていません。
ありがとうございました、
シルバータイガー