I have a feeling I've botched the design of my app from a high level. Right now, I have one Controller, the App Delegate, Two UIViews (one is a subclass of Scrollview) and one nib for the controller.
In IB, I have set the class of the file owner to MusicGridController and then set the class of the UIView to MusicGridView. Thus, the instances of those classes are instantiated by the nib, right? Then, I have a UIScrollView, that I want to be layered on top of the MusicGridView. In the app Delegate, I've done this:
@synthesize window;
@synthesize viewController;
@synthesize scrollView;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
//[application setStatusBarHidden:YES animated:NO];
//[window addSubview:viewController.view];
scrollView.contentSize = CGSizeMake(480, 480);
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.alwaysBounceVertical = NO;
scrollView.alwaysBounceHorizontal = NO;
// scrollView.maximumZoomScale = 4.0;
// scrollView.minimumZoomScale = 0.75;
scrollView.delegate = self;
// [viewController.view addSubview:scrollView];
[window addSubview:scrollView];
[scrollView addSubview:viewController.view];
[window makeKeyAndVisible];
}
So, I'm adding the scrollView subclass to the window, then the view of the Controller as a subview of scrollView.
I think I'm fundamentally messed up on the architecture. Almost all of the code that interacts with the user so far is in my MusicGridView, and the controller literally does nothing.
My problem I'm running into now is that I need to pass touch events from the UIScrollview to the MusicGridView instance, but I don't know how to pass it to the right instance.
Ideally, I think I should probably load MusicGridView in the init method of the UIScrollView subclass, and then maybe have the UIView be an instance of the UIScrollView subclass. Would that work?