5つを超えるビューがあるため、「More」ビューコントローラーを備えたタブバー(UITabBarController)アプリケーションがあります。私のアプリケーションの残りの部分は黒の背景と白のテキストを持っており、これに一致するようにこのテーブルをカスタマイズすることができました。ただし、この結果、通常は[その他]テーブルの左側に表示されるタブバーの画像は表示されません(背景が白であるため)。背景が黒のタブバーと同じようにタブバーの画像を表示する方法を見つける必要があります。
例:
TabBarControllerをサブクラス化し、「MoreTableView」のデータソースを変更しました。
TabBarController.m
- (void)viewDidLoad {
[super viewDidLoad];
UINavigationController *moreController = self.moreNavigationController;
moreController.navigationBar.barStyle = UIBarStyleBlackOpaque;
if ([moreController.topViewController.view isKindOfClass:[UITableView class]])
{
UITableView *view = (UITableView *)moreController.topViewController.view;
view.separatorColor = [[UIColor alloc] initWithRed:0.3 green:0.3 blue:0.3 alpha:1.0];
view.backgroundColor = [UIColor blackColor];
view.dataSource = [[MoreTableViewDataSource alloc] initWithDataSource:view.dataSource];
}
}
MoreTableViewDataSource.m
-(MoreTableViewDataSource *) initWithDataSource:(id<UITableViewDataSource>) dataSource
{
originalDataSource = dataSource;
[super init];
return self;
}
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
return [originalDataSource tableView:table numberOfRowsInSection:section];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [originalDataSource tableView:tableView cellForRowAtIndexPath:indexPath];
cell.textColor = [[UIColor alloc] initWithRed:1 green:0.55 blue:0 alpha:1.0];
cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"customAccessory.png"]];
return cell;
}
よろしくお願いします、
ジュリアン