views:

51

answers:

2

I need to write an app that runs for iPhone and iPad.

The issue I'm running into is how do you setup an iPadView and an iPhoneView to hook to the same controller?

In other words, I don't want to have any duplicate controller code--I should only have to make a different view for each device.

Right now I link up view->controller by choosing "Add->New File->iPhone View with Controller", and this works for one device. But the code in the event handlers I have wired up should not have to be duplicated by going to "Add->New File->iPad View with Controller".

A link to a tutorial may help, I have been doing .Net Windows development for a while but still learning iPhone and MonoTouch.

A: 

Can you not just have a base controller and then inherit from that in both view controllers?

cvista
I tried something similar, I made 1 controller and wired it to an iPhone-View and a iPad-View. The only issue is the designer is declaring my outlets and partial methods (Actions) twice. I feel inheriting would do the same thing. Am I doing it wrong?
Jonathan.Peppers
PS - I can comment out the designer.cs file on one of my Views to make it compile, but I shouldn't have to do this, right?
Jonathan.Peppers
A: 

This link talks about code generation for .xib files:

MonoTouch Doc

Apparently you can just delete your .xib.designer.cs file to turn off the code generation. Is this the right way to do it?

Otherwise I'll mark this as the answer.

Jonathan.Peppers