0
我为我的应用程序创建了一个自定义Tabbarcontroller。现在我有一个uiview,在底部我想显示我的tabviewcontroller没有选择任何按钮。当用户按下任何按钮时,它将加载所选择的tabbar项目的相应视图。不知何故,我的下面的代码不起作用。它会显示一个白色屏幕来代替我的uview视图,并且不会在底部显示一个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;
}