我在 UIPopoverController 中使用 MonoTouch.Dialog 为我们的 iPad 用户提供一系列可使用的设置。在我的应用程序中,我正在使用这个 CalendarView (http://escoz.com/blog/monotouch-calendar-control-is-here/),因此用户可以为应用程序设置日期(这些设置用于在谷歌地图)。
无论如何,我遇到了一些关于 UIPopoverController 的大小问题......无论我如何设置内容大小,一旦我更深入地单击 .Dialog 的树,UIPopoverController 就会调整自身的大小,这会导致在所述日历视图上出现不希望的大小。
随附的是我所看到的示例。您会注意到,我的内容大小为 450x420。单击任何选项后,弹出框会自行调整大小。我希望这个弹出框始终保持相同的大小。
我在这里遗漏了一些明显的东西吗?任何帮助将非常感激。
从 myPopOverView.cs 声明并启动弹出框:
UIPopoverController myPopOver = new UIPopoverController(new myPopOverView());
btnSearch.TouchUpInside += (sender, e) => {
myPopOver.PopoverContentSize = new SizeF(450f, 420f);
myPopOver.PresentFromRect (btnPopOver.Frame, this.View, UIPopoverArrowDirection.Down, true);
}
来自 myPopOverView.cs:
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
var root = CreateRoot ();
var dv = new DialogViewController (root, true);
this.PushViewController (dv, true);
}
RootElement CreateRoot ()
{
return new RootElement ("Find Stuff") {
new Section (){
new RootElement ("States", new RadioGroup (0)){
new Section (){
new RadioElement ("New York"),
new RadioElement ("California"),
new RadioElement ("Texas"),
}
} ,
} ,
new Section (){
new RootElement ("Places", new RadioGroup (0)){
new Section (){
new RadioElement ("New York City"),
new RadioElement ("San Francisco"),
new RadioElement ("Dallas"),
}
} ,
} ,
new Section (){
new RootElement ("Products") {
from sh in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
select new Section (sh + " - Section") {
from filler in "12345"
select (Element) new CheckboxElement (sh + " - " + filler, true, "kb")
}
} ,
}
} ;
}