I have done one iPhone app in Objective-C. When I want to link a Label to some data in that I would declare it like this:
@interface CityDetailViewController : UIViewController {
UILabel *cityName;
}
@property(nonatomic, retain) IBOutlet UILabel *cityName;
And then when the CityDetailViewController object is created in code I would set the city name like this [self.cityView.cityName setText:city.name];
I can't, for the life of me, figure out how to do this in MonoTouch. I tried manually creating the Outlets through Interface Builder and I tried adding this code that I found in the .designer.cs file from another project:
[MonoTouch.Foundation.Connect("headlineLabel")]
private MonoTouch.UIKit.UILabel headlineLabel {
get {
return ((MonoTouch.UIKit.UILabel)(this.GetNativeField("headlineLabel")));
}
set {
this.SetNativeField("headlineLabel", value);
}
}
And I've tried a combination of both of those things. They don't work. The closest I can get is to actually apply the Outlet using Interface Builder, but when my View is declared I get this error:
this class is not key value coding-compliant for the key headlineLabel.
So I'm completely at a loss. Can someone explain this to me please?