1
Monotouch 4.2 beta。我想添加UISegmentedControl
到UIToolbar
。 問題是切換段時沒有事件觸發。我在這裏錯過了什麼?UISegmentedControl:在UIToolbar中使用時不觸發事件
this.oBookmarkSwitch = new UISegmentedControl(new UIImage[] { UIImage.FromFile("./images/index.png"), UIImage.FromFile("./images/bookmark_grey.png") });
this.oBookmarkSwitch.TouchUpInside += delegate {
Console.WriteLine("TOUCHY - never fires");
};
this.oBookmarkSwitch.ValueChanged += delegate {
Console.WriteLine("CHANGE - only fires once when the control is created");
};
this.oBookmarkSwitch.Frame = new RectangleF(0, 0, 100, 30);
this.oBookmarkSwitch.ControlStyle = UISegmentedControlStyle.Bar;
aBarButtons.Add(new UIBarButtonItem(this.oBookmarkSwitch));
oIndexToolbar.SetItems (aBarButtons.ToArray(), false);
但是,單擊控件時,ValueChanged也不會觸發。看我上面的例子。它在創建控件的實例時被調用一次,但在觸摸時不會被調用。 – Krumelur
poupou,不要打擾現在尋找答案!如果我在一個單獨的項目中執行它,它就可以工作所以它似乎是別的東西的副作用。如果我發現問題,我會發布。對不起,打擾你。 – Krumelur