【发布时间】:2012-03-06 14:26:36
【问题描述】:
我是 iOS 开发的初学者,需要一些帮助:
我有一个带有 2 个嵌套 TableView 的 UIViewController。 (类似here的实现)
.h 文件
#import <UIKit/UIKit.h>
@interface TabAboutViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
}
@property (nonatomic, strong) NSArray *navigationList;
@end
.m 文件
#import "TabAboutViewController.h"
@interface TabAboutViewController ()
@end
@implementation TabAboutViewController
#pragma mark -
#pragma mark Synthesize
@synthesize navigationList;
@synthesize informationTableView;
#pragma mark -
#pragma mark View Load
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
navigationList = [NSArray arrayWithObjects:@"Was leistet die App?",@"Wie wird gemessen?",@"Wie wird ausgewertet?",@"Was sind die Vorteile?",nil];
}
#pragma mark -
#pragma mark View UnLoad
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
#pragma mark -
#pragma mark View Rotates
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
#pragma mark -
#pragma mark Table Management
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.navigationList count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"aboutCell"];
NSString *cellText = [self.navigationList objectAtIndex:indexPath.row];
cell.textLabel.text = cellText;
return cell;
}
@end
现在我想为 UIViewController 中的一个 TableViews 设置背景颜色,但我不知道如何以及在哪里进行。我不想在情节提要中更改它。
【问题讨论】:
标签: ios xcode uitableview uiview interface-builder