我正在使用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