iPad的 - 自动调整为UITableView的

问题描述:

我的代码是在这里:iPad的 - 自动调整为UITableView的

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); 

我对_contentView和_contentView上self.view 在iPhone上添加一个tableview中没有问题的作品不错,但在iPad上,我不知道为什么,当我为表格视图设置了自动调整遮罩,它增加了宽度和高度......没有自动调整遮罩效果很好,但我需要自动调整风景遮罩。如何解决这个问题?

与自动尺寸面具 with autoresizing mask 没有在自动屏蔽 without autoresizing mask

+0

如何捕捉方向事件并修改自动调整掩码? – Tutankhamen

+0

我想工作只是自动调整面膜 –

一旦尝试这种

_contentView.autoresizesSubviews = YES ; 

希望这会工作。