내 응용 프로그램에 대한 사용자 지정 Tabbarcontroller를 만들었습니다. 이제 uiview 어디에서 어떤 단추를 선택하지 않고 내 tabviewcontroller 표시하려면 아래쪽에 있습니다. 사용자가 아무 버튼이나 누르면 선택된 탭 모음 항목의 해당보기가로드됩니다. 어떻게 든 내 아래 코드는 작동하지 않습니다. 내 uiview 화면 대신 흰색 화면을 표시하고 하단에 tabbar를 표시하지 않습니다.UITabBarController 표시에 대한 도움말
#import <UIKit/UIKit.h>
#import "UICustomTabViewController.h"
@interface AssignmentViewController : UIViewController<UITabBarDelegate, UITableViewDelegate,UITableViewDataSource> {
NSMutableArray *listAssignments;
NSMutableArray *staffImages;
UICustomTabViewController *tabViewController;
}
@property (nonatomic, retain) UICustomTabViewController *tabViewController;
@end
- (void)viewDidLoad {
UICustomTabViewController *tvController = [[UICustomTabViewController alloc] initWithNibName:@"TabViewController" bundle:nil];
self.tabViewController = tvController;
[self.view addSubview:tvController.view];
listAssignments = [[NSMutableArray alloc] init];
staffImages = [[NSMutableArray alloc] init];
//Add items
[listAssignments addObject:@"TRANSPORTATION"];
[listAssignments addObject:@"ROOMS"];
[listAssignments addObject:@"FOOD & BEVERAGES"];
//Set the title
self.navigationItem.title = @"ASSIGNMENTS";
[super viewDidLoad];
[tvController release];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
tableView.separatorColor=[UIColor grayColor];
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.textLabel.textColor=[UIColor blackColor];
cell.textLabel.text=[listAssignments objectAtIndex:indexPath.row];
cell.textLabel.font=[UIFont systemFontOfSize:16];
return cell;
}