UIPopoverController w/MonoTouch.Dialog 会导致弹出框不必要的大小调整
我在 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")
}
} ,
}
} ;
}
I am using MonoTouch.Dialog within a UIPopoverController to give our iPad users a series of settings to work with. In my app, I am using this CalendarView (http://escoz.com/blog/monotouch-calendar-control-is-here/) so the user can set dates for the application (the settings are used to configure timed locations on a Googlemap).
Anyway, I am experiencing some sizing issues concerning the UIPopoverController... Regardless of how i set the content size, once i click deeper into the tree of .Dialog, the UIPopoverController resizes itself which is causing undesired sizing on said calendar view.
Enclosed is a sample of what Im seeing. You will notice, I have the content sized at 450x420. Once I click any of the options, the popover resizes itself. I want this popover to remain the same size all of the time.
Am I missing something obvious here? Any help would be much appreciated.
Declares and launches popover from 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);
}
from 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")
}
} ,
}
} ;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每次 TopViewController 更改时,UIPopoverController 都会尝试自动协商其 ContentSize。
您应该通过重写 WillShowViewController 方法并在那里设置 SizeF 来为每个呈现的 UIViewController 设置 ContentSizeForViewInPopover。
Every time the TopViewController changes UIPopoverController will attempt to auto-negotiate it's ContentSize.
You should set the ContentSizeForViewInPopover for each UIViewController being presented by overriding the WillShowViewController method and setting the SizeF there.