xcode 在 Storyboard 中调整 TableViewController 的 TableView 的大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24702192/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Resize a TableView of a TableViewController in Storyboard
提问by Andorath
I have a UITableviewController created with storyboard. Now i want to change the X and Y coordinates of the table view (specifically i want to put a little bit down the table view). There's an option in storyboard where i can set this parameter or change the tableview size? I can't find it
我有一个用故事板创建的 UITableviewController。现在我想改变表格视图的 X 和 Y 坐标(特别是我想把表格视图放下一点)。故事板中有一个选项,我可以在其中设置此参数或更改 tableview 大小?我找不到
I've tried looking in the size inspector but it looks like X and Y parameter are disabled.
我试过查看尺寸检查器,但看起来 X 和 Y 参数被禁用。
回答by Kathiravan G
The tableview of UITableViewController is main view so we cannot adjust it in storyboard . If u want adjust size try this. In your UITableViewController .
UITableViewController 的 tableview 是主视图,所以我们不能在 storyboard 中调整它。如果你想调整大小试试这个。在您的 UITableViewController 中。
- (void)viewDidAppear:(BOOL)animated
{
[self.tableView setFrame:CGRectMake(x, y, width, height)];
}
It is viewDidAppear
not viewWillAppear
它viewDidAppear
不是viewWillAppear
回答by oabarca
I recommend you to drag a UIView to the UITableView. This will create a panel where you can add components and will make the UITableView go down. however, the UIView will also scroll down along with the table cells.
我建议你拖一个 UIView 到 UITableView。这将创建一个面板,您可以在其中添加组件并使 UITableView 关闭。但是,UIView 也会与表格单元格一起向下滚动。
Another option is to create a UIViewController. Drag into it a UITableView. In this way, the tableview is fully resizable.
另一种选择是创建一个 UIViewController。将 UITableView 拖入其中。通过这种方式,tableview 可以完全调整大小。
回答by Sten
Create a UIViewController with a Container View. Link the UITableViewController to the container. Now you can resize the table view by resizing the container.
创建一个带有容器视图的 UIViewController。将 UITableViewController 链接到容器。现在您可以通过调整容器大小来调整表视图的大小。