I went ahead and created a new project, and created a subclass of UIView and UIViewController along with it. I then added an instance of the ViewController to the delegate's header (along with an @property and @synthesize) and added this to applicationDidFinishLaunching
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after application launch
viewController = [[MyViewController alloc] init];//added
[window addSubview:viewController.view];//added
[window makeKeyAndVisible];
}
MyView only has initWithFrame implemented to set the background color to orange
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
self.backgroundColor = [UIColor orangeColor];
}
return self;
}
Lastly, the ViewController looks as such
- (void)loadView {
self.view = [[MyView alloc] initWithFrame:[UIScreen mainScreen].bounds];
}
- (void)viewDidLoad {
[super viewDidLoad];
}
-(void) touchedEnded:(NSSet *) touches withEvent:(UIEvent *) event
{
NSLog(@"Touches ended");
}
I get a pretty orange screen, but nothing showing up in the console when I poke at it. In the project I've been working on, I haven't fiddled with touchesBegan, userInteractionEnabled, or exclusiveTouch, nor did I create a second UIWindow. I did draw an image in the view as the background, but even without doing that in the above code, I'm still not getting touches to respond properly. Which must mean I'm missing something else. It's probably staring me right in the face, too.