【问题标题】:iPad - Autoresizing for UITableViewiPad - UITableView 的自动调整大小
【发布时间】:2012-08-28 15:40:38
【问题描述】:

我的代码在这里:

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 上添加了一个 tableview,在 self.view 上添加了 _contentView 在 iPhone 上运行良好,没有问题,但在 iPad 上,我不知道为什么当我为表格视图设置自动调整蒙版时,它会增加宽度和高度......如何解决?

带有自动调整大小的蒙版 没有自动调整大小的蒙版

【问题讨论】:

  • 捕捉方向事件并修改您的自动调整蒙版怎么样?
  • 我只想自动调整掩码大小

标签: ios ipad uiview autoresizingmask


【解决方案1】:

试试这个

_contentView.autoresizesSubviews = YES ;

希望这会奏效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多