我已经在Objective-C中完成了一个iPhone应用程序。当我想给一个标签链接到一些数据我会宣布这样的:如何在MonoTouch中做IBOutlets?
@interface CityDetailViewController : UIViewController {
UILabel *cityName;
}
@property(nonatomic, retain) IBOutlet UILabel *cityName;
然后在代码中创建CityDetailViewController对象时,我将设置城市名这样[self.cityView.cityName setText:city.name];
我在我的生活中,不可能知道如何在MonoTouch中做到这一点。 我试图手动创建通过Interface Builder的奥特莱斯和我尝试添加该代码,我在了.Designer.cs文件中找到从另一个项目:
[MonoTouch.Foundation.Connect("headlineLabel")]
private MonoTouch.UIKit.UILabel headlineLabel {
get {
return ((MonoTouch.UIKit.UILabel)(this.GetNativeField("headlineLabel")));
}
set {
this.SetNativeField("headlineLabel", value);
}
}
我都试过这些东西的组合。 他们不工作。 我能得到的最接近的是实际应用使用界面生成器的出口,但是当我的观点是宣布我得到这个错误:
this class is not key value coding-compliant for the key headlineLabel.
所以我完全不知所措。 有人可以向我解释这个吗?
1为努力 – 2010-02-17 11:50:06
另一个努力。 – 2010-02-17 14:50:55
另一个 – 2010-03-08 14:15:36