How do I add a custom view to iPhone app's UI?

Posted by Dr Dork on Stack Overflow See other posts from Stack Overflow or by Dr Dork
Published on 2010-05-12T23:26:35Z Indexed on 2010/05/12 23:34 UTC
Read the original article Hit count: 335

I'm diving into iPad development and I'm still learning how everything works together. I understand how to add standard view (i.e. buttons, tableviews, datepicker, etc.) to my UI using both Xcode and Interface Builder, but now I'm trying to add a custom calendar control (TapkuLibrary) to the left window in my UISplitView application. My question is, if I have a custom view (in this case, the TKCalendarMonthView), how do I programmatically add it to one of the views in my UI (in this case, the RootViewController)? Below are some relevant code snippets from my project...

RootViewController interface

@interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate> {

    DetailViewController *detailViewController;

    NSFetchedResultsController *fetchedResultsController;
    NSManagedObjectContext *managedObjectContext;
}

@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController;

@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;

- (void)insertNewObject:(id)sender;

TKCalendarMonthView interface

@class TKMonthGridView,TKCalendarDayView;
@protocol TKCalendarMonthViewDelegate, TKCalendarMonthViewDataSource;


@interface TKCalendarMonthView : UIView {

    id <TKCalendarMonthViewDelegate> delegate;
    id <TKCalendarMonthViewDataSource> dataSource;

    NSDate *currentMonth;
    NSDate *selectedMonth;
    NSMutableArray *deck;


    UIButton *left;
    NSString *monthYear;
    UIButton *right;

    UIImageView *shadow;
    UIScrollView *scrollView;


}
@property (readonly,nonatomic) NSString *monthYear;
@property (readonly,nonatomic) NSDate *monthDate;
@property (assign,nonatomic) id <TKCalendarMonthViewDataSource> dataSource;
@property (assign,nonatomic) id <TKCalendarMonthViewDelegate> delegate;

- (id) init;
- (void) reload;
- (void) selectDate:(NSDate *)date;

Thanks in advance for all your help! I still have a ton to learn, so I apologize if the question is absurd in any way. I'm going to continue researching this question right now!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ipad