我正在使用UIPopoverController中的MonoTouch.Dialog为iPad用户提供一系列设置。在我的应用程序中,我使用此CalendarView(http://escoz.com/blog/monotouch-calendar-control-is-here/),以便用户可以为应用程序设置日期(该设置用于配置定时位置一个Googlemap)。带有MonoTouch.Dialog的UIPopoverController会导致不必要的弹出窗口大小
无论如何,我遇到了一些关于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")
}
} ,
}
} ;
}
谢谢Anuj,推动正确的方向。我结束了我的UINavigationController是有覆盖的WillShowViewController设立代表...工作就像一个冠军! (I甚至可以使用在视图控制器的开关来设置每视图控制器高度)谢谢! – 2012-02-07 20:29:58
太棒了,很高兴帮助。这实际上听起来像一个很好的候选人,以代替委托方法重写的.NET eventification。随意标记为答案,如果达到了预期的行为:-) – Anuj 2012-02-07 20:41:48