iPad - 为UITableView自动化

时间:2012-08-28 15:40:38

标签: ios ipad uiview autoresizingmask

我的代码就在这里:

CGRect mainFrame = [UIScreen mainScreen].bounds;

_contentView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0.0, mainFrame.size.width, mainFrame.size.height-20)] autorelease];
_contentView.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
_contentView.backgroundColor = [UIColor clearColor];
[self.view addSubview:_contentView];


self.tableView = [[[UITableView alloc] initWithFrame:_contentView.frame style:UITableViewStylePlain] autorelease];
[self.tableView setBackgroundColor:[UIColor clearColor]];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
[self.tableView setSeparatorColor:[UIColor clearColor]];
[_contentView addSubview:_tableView];
self.tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);

我在self.view上的_contentView和_contentView上添加了一个tableview 在iPhone上运行良好没有问题,但在iPad上我不知道为什么当我为表视图设置自动调整掩码时,它增加宽度和高度...没有自动调整掩码工作良好,但我需要自动化掩模的景观。怎么解决这个问题?

使用自动调整遮罩 with autoresizing mask 没有自动调整掩码 without autoresizing mask

1 个答案:

答案 0 :(得分:0)

尝试一次

Color.parseColor

希望这会奏效。