Reputation: 8653
I have a UIViewController in MonoTouch, defined together with a .xib as an iPad View Controller.
If i change the UIViewController to use a dynamic type like this:
public partial class CustomCount : UIViewController<tUnit> where tUnit : struct
{
private tUnit someVariable;
... (rest of class goes here) ...
Then monoTouch no longer seems to generate corresponding .h and .m files in it's xCode project for this view controller.
Because of this, i can no longer access any of the UI outlets (as they are defined in the .m file)
If i remove the tTUnit
dynamic type, everything works fine.
The where tUnit : struct
portion makes no difference to MonoTouch.
Is there any known solution to this, or should i just create sepearate versions of my class for every type i am expecting?
Upvotes: 1
Views: 210
Reputation: 26505
Is being a struct
required? You could use an interface otherwise.
Can you do this instead:
public partial class CustomCount : UIViewController
{
//Use a static method here
public static CustomCount Create(ISomeInterface yourVariable) { return new Customcount() { someVariable = yourVariable }; }
//Private Constructor
private CustomCount() { }
private ISomeInterface someVariable;
}
You could event just make someVariable
a public property or something.
Upvotes: 2