簡體   English   中英

從UIViewController派生的類中的Monotouch Dialog實現

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM