Xamarin.ios UIPOPOOVERCONTROLLER w/MonoTouch.Dialog会导致不必要的popover大小调整
我使用UIPopoverController中的MonoTouch.Dialog为我们的iPad用户提供一系列的设置。在我的应用程序中,我正在使用此日历视图(http://escoz.com/blog/monotouch-calendar-control-is-here/)因此,用户可以为应用程序设置日期(这些设置用于在谷歌地图上配置定时位置) 无论如何,我遇到一些关于UIPopoverController的大小调整问题。。。无论我如何设置内容大小,一旦我深入到.Dialog的树中单击,UIPopoverController会调整自身大小,这会在所述日历视图上造成不必要的大小调整 随信附上我所看到的样品。您会注意到,我的内容大小为450x420。单击任何选项后,popover会自动调整大小。我希望这件府绸一直保持原样大小 我是不是漏掉了什么明显的东西?任何帮助都将不胜感激 从myPopOverView.cs声明并启动popover:Xamarin.ios UIPOPOOVERCONTROLLER w/MonoTouch.Dialog会导致不必要的popover大小调整,xamarin.ios,uipopovercontroller,monotouch.dialog,Xamarin.ios,Uipopovercontroller,Monotouch.dialog,我使用UIPopoverController中的MonoTouch.Dialog为我们的iPad用户提供一系列的设置。在我的应用程序中,我正在使用此日历视图(http://escoz.com/blog/monotouch-calendar-control-is-here/)因此,用户可以为应用程序设置日期(这些设置用于在谷歌地图上配置定时位置) 无论如何,我遇到一些关于UIPopoverController的大小调整问题。。。无论我如何设置内容大小,一旦我深入到.Dialog的树中单击,UIPo
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);
}
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")
}
} ,
}
} ;
}
从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);
}
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")
}
} ,
}
} ;
}
每次TopViewController更改UIPopoverController时,它都会尝试自动协商其内容大小
您应该通过覆盖WillShowViewController方法并在那里设置SizeF来为每个呈现的UIViewController设置ContentSizeForvieWinPover。谢谢您,Anuj,让我们向正确的方向推进。我最终为我的UINavigationController设置了一个代理,该代理具有WillShowViewController的覆盖。。。像冠军一样工作!(我甚至可以使用视图控制器上的开关来设置每个视图控制器的高度)谢谢!!太棒了,很高兴能帮上忙。实际上,这听起来像是一个很好的.NET事件化替代委托方法重写的候选者。如果达到了期望的行为,请随意标记为答案:-)