UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
table.backgroundColor = [UIColor clearColor];
table.delegate = self;
table.dataSource = self;
[self.view addSubview:table];
[table release];
最近发现传统的方法创建出来的table在左边有大概20像素的偏移,修复偏移可以使用以下方法
UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
table.backgroundColor = [UIColor clearColor];
table.delegate = self;
table.dataSource = self;
[self.view addSubview:table];
if ([table respondsToSelector:@selector(setSeparatorInset:)]) {
[table setSeparatorInset:UIEdgeInsetsZero];
}
[table release];