在 MonoTouch.Dialog 中调整表格宽度 [英] Resizing Table Width in MonoTouch.Dialog
问题描述
我想覆盖默认情况下提供给 MonoTouch.Dialog 表格的表格宽度.
I would like to override the table width that is given to MonoTouch.Dialog's tables by default.
推荐答案
你不能这样做,因为它使用了 UITableView/UITableViewController,它们有一些特殊的功能来占用父视图的宽度.你可以做的是让 UIView 充当一个容器",它的大小适合你想要的高度和宽度,然后将 TableView 添加为它的子视图.现在 DialogViewController 的 TableView 将调整到您的容器.
You can't do this, because it uses UITableView/UITableViewController which have some special features to take up the width of the parent view. What you can do is make a UIView to act as a "container" that is sized to the height and width you want, then add the TableView as a subview to that. Now the DialogViewController's TableView will size to your container.
Note* Container 然后作为子视图添加到您的控制器视图中.
Note* Container is then added as a subview to your controllers View.
container = new UIView(frameSize);
dvc = new DialogViewController(...);
container.AddSubview(dvc.TableView);
View.AddSubview(container);
这篇关于在 MonoTouch.Dialog 中调整表格宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!