Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
May 22, 2010
939
41
Tokyo, Japan
I tried to create a Universal App. I made some shared classes as below:
Code:
#import <UIKit/UIKit.h>
#import "MZMonthView.h"
@interface MZCalendarViewController : UIViewController {
@protected
	MZMonthView *monthView;
}
@property (nonatomic, retain) IBOutlet MZMonthView *monthView;
@end
Code:
#import <UIKit/UIKit.h>
#import "utility.h"
#import "MZDaysOfMonth.h"
@interface MZMonthView : UIView {
	NSArray *daysOfMonth;
}
@end
Code:
#import <Foundation/Foundation.h>
@interface MZDaysOfMonth : NSObject {
}
@end

Then I just created classes for both iPad and iPhone as below:
Code:
#import <Foundation/Foundation.h>
#import "MZCalendarViewController.h"
@interface MZCalendarViewController_iPad : MZCalendarViewController {
}
@end
Code:
#import <UIKit/UIKit.h>
#import "MZCalendarViewController.h"
@interface MZCalendarViewController_iPhone : MZCalendarViewController {
}
@end
Code:
#import <UIKit/UIKit.h>
#import "MZMonthView.h"
@interface MZMonthView_iPad : MZMonthView {
}
@end
Code:
#import <UIKit/UIKit.h>
#import "MZMonthView.h"
@interface MZMonthView_iPhone : MZMonthView {
}
@end

My question is, how do I use such shared classes, in detail,
do I have to put MZMonthView *monthView in MZCalendarViewController *calendarViewController;
in this case, I don't have different view for iPad or iPhone.

or put MZMonthView_iPad *monthView in MZCalendarViewController_iPad *calendarViewController;
and put MZMonthView_iPhone *monthView in MZCalendarViewController_iPhone *calendarViewController;
in this case, I can have different view for iPad or iPhone, but MZCalendarViewController seems like not shared...

I hope that you can give me some suggestion.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.