我正在尝试创建自己的BackBarButtonItem,但我遇到了一些问题.
我的声明:
var backButon = new UIBarButtonItem("Back",UIBarButtonItemStyle.Plain, null, null);
Run Code Online (Sandbox Code Playgroud)
例外:
Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: target
Run Code Online (Sandbox Code Playgroud)
我应该在"目标"和"行动"参数中加入什么?
你不应该使用那个构造函数,除非你想使用目标/动作模式,我建议:
public UIBarButtonItem (string title, UIBarButtonItemStyle style, EventHandler handler)
Run Code Online (Sandbox Code Playgroud)
您使用的像:
var btn = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
Console.WriteLine ("button clicked");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1625 次 |
| 最近记录: |