MonoTouch Hello World 教程中的部分类声明错误 [英] Partial Class Declaration Error in MonoTouch Hello World tutorial
问题描述
我正在尝试 MonoTouch 试用版中的 Hello World 教程,并且我已经输入了所有代码并尝试了构建.
I'm trying out the Hello World tutorial in the MonoTouch Trial version and I have put in all the code and attempted a build.
在 designer.cs
文件中,行
partial void actBtn (MonoTouch.Foundation.NSObject sender)
给出错误
部分方法HelloWorld_iPhone.HelloWorld_iPhoneViewController.actBtn (MonoTouch.Foundation.NSObject sender)"的实现缺少部分方法声明.
A partial method 'HelloWorld_iPhone.HelloWorld_iPhoneViewController.actBtn (MonoTouch.Foundation.NSObject sender)' implementation is missing a partial method declaration.
我错过了什么?
我应该补充一点,这一行是由 MonoTouch 自动插入的 - 我只写了后面的一行方法代码.
I should add that this line was inserted automatically by MonoTouch - I only wrote the single line of method code which follows.
推荐答案
我可以通过将语句放在文件 controller.cs 中来实现.
I could achieve it by putting the statement in the file controller.cs.
在我的例子中是这样的:
In my example this way:
partial void action1 (MonoTouch.Foundation.NSObject sender);
在我的designer.css中:
and in my designer.css:
[Action ("action1:")]
partial void action1 (MonoTouch.Foundation.NSObject sender){
this.lblOutput.Text=" Action 1 activated";
}
这意味着语句在一个单独的类中,并在设计器中实现.
which means that the statement is in a separate class, and implementation in the designer.
这篇关于MonoTouch Hello World 教程中的部分类声明错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!