[英]Monotouch Dialog implementation in a Class derived from UIViewController
我只想從MonoTouch.Dialog覆蓋Selected
方法。 很簡單,我無法弄清楚正確的方法..
我有一個派生自UIViewController
的類FirstView。 我在其中宣布
DialogViewController viewController = new DialogViewController();
同樣在這個類中,我用一個包含UILabel
的部分填充viewController。
現在我想點擊包含標簽的行 - 我不想要一個按鈕或其他事件,我必須使用覆蓋!
我知道這是一個相當容易的問題,但我無法做到這一點。
非常感謝你!
如果您希望覆蓋MonoTouch.Dialog中的方法,則需要定義自己的類型。 這是自定義MonoTouch.Dialog的最佳方式(當事件不可用時)。
在這種情況下, Section
繼承自Element
,其中定義了Selected
方法。 所以做以下事情:
public class MySection : Section {
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
// do your own processing
}
}
應該允許您在調用Selected
時調用/執行自己的代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.