私は a から始めたのではUIWindow
なく、 a から始めUIView
てUITabBarController
.
ファイル名の配列がありdocumentFileName
、サブビューに 1 つずつ、それぞれ 1 つのタブにロードしたいと考えています。
viewControllers = [[NSMutableArray alloc] init];
(NSString *tempStr in documentFileName) {
Subview *subviewController = [[Subview alloc] initWithFileName:tempStr];
[viewControllers addObject:subviewController];
}
tabBarController.viewControllers = viewControllers;
[self.view addSubview:tabBarController.view];
}
SubView.m で:
- (id) initWithFileName:(NSString *)fileName {
isiPhone = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone;
if (self = [super initWithNibName:((isiPhone)?@"NFLSPromDressingsSubview_iPhone":@"NFLSPromDressingsSubview_iPad") bundle:nil])
{
currentFileName = fileName;
}
return self;
}
- (void) viewDidLoad {
[self loadDocuments];
UITabBarItem *theItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:[documentFileName indexOfObject:currentFileName]];
self.tabBarItem = theItem;
}
ただし、タブ バーは白くて空に見えます。どこで間違いを犯しましたか?ありがとう。