1. UITableViewController中,默认的tableView是没法修改其Frame的。 spa
若要修改须要本身建立一个UITableView的对象。加入到self.view中 code
2. IOS6中 UITableViewStyleGrouped类型没法设置背景颜色,须要修改BackgroundView属性 对象
- (void)viewDidLoad { ITableView *tableV = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 460) style:UITableViewStyleGrouped]; tableV.backgroundView =nil; //这里! tableV.backgroundColor = [UIColor clearColor]; tableV.dataSource =self; tableV.delegate =self; [self.view addSubview:tableV]; }
3.UITableViewStyleGrouped类型的Cell会有边线,很是乱,须要修改Cell的BackgroundView it
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString * cellIndef = @"cellIndef"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIndef]; if (!cell) { cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndef]autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; [cell setBackgroundView:nil]; //这里 } return cell; }
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES]; //这里 }
5. 在table内容为空时显示空白的视图,取代默认的。 io
- (void)viewDidLoad { .. tableView.separatorStyle = UITableViewCellSeparatorStyleNone; .. } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if ([array count]>0) { tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine; } return [array count]; }