Gal3rielol
2013-05-13 21:52:05 +08:00
在viewDidLoad:里面这么做
- (void)viewDidLoad
{
[super viewDidLoad];
//Do the stuff about tableview
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
//Add a container view as self.view and the superview of the tableview
UITableView *tableView = (UITableView *)self.view;
UIView *containerView = [[UIView alloc] initWithFrame:self.view.frame];
tableView.frame = tableView.bounds;
self.view = containerView;
[containerView addSubview:tableView];
//add the view as a subview of the container view, it will be fixed on the top
UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
topView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
[self.view addSubview:topView];
}