Resizing Table Width in MonoTouch.Dialog

2019-08-03 05:01发布

问题:

I would like to override the table width that is given to MonoTouch.Dialog's tables by default.

回答1:

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 is then added as a subview to your controllers View.

container = new UIView(frameSize);
dvc = new DialogViewController(...);
container.AddSubview(dvc.TableView);
View.AddSubview(container);