0

(touchesBegan not called in a UIView subclass) from this topic an extension.

I am having a similar problem to the above linked discussion, years later, trying to upgrade a working (released) APP from 2009 to the latest iOS 9.3. I had to add a UIViewController to prevent a crash and get the APP to load in the Simulator (XCODE MAC latest, iPhone6). The drawView routine is being called repeatedly to refresh the screen as expected, and things on screen are animated as designed. However NO CLICKS. touchesBegan/Ended never get called. I can start loading up code, but wondering if anything immediate comes to mind since it seems everyone has this problem, or something like it, at some point and it is typically a very simple fix. Thank you.

Update: It might be the extra uiViewController messing with the uiView but that's an addition between these APP versions that is required and no longer auto-generated.

Tried setting the uiView as firstResponder:

    - (id)initWithCoder:(NSCoder*)coder {
        if ((self = [super initWithCoder:coder])) {
            [self setUserInteractionEnabled:YES];
            [self setMultipleTouchEnabled:YES];
            [self becomeFirstResponder];

These are the uiView's (glView) touch'ers:

    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { }
    - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { }
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
        int page; [self adjustPage:&page with:0];
        ... }
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        int page; [self adjustPage:&page with:0];
        ... }

This is my view @interface EAGLView : UIView <UIAccelerometerDelegate> {. And added this viewController to the delegate to make it not crash on loading.

    @implementation OpenGLESAppDelegate
    @synthesize window;
    @synthesize glView;
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        UIViewController* vc = [[UIViewController alloc]initWithNibName:nil bundle:nil];
        self.window.rootViewController = vc;   
        glView.animationInterval = AHZ;
        [glView startAnimation];
        return YES;
        }

No compile or runtime errors.

Community
  • 1
  • 1

1 Answers1

0

I HAVE CLICKS !!! Forgot to assign the old view to the new viewController: vc.view = glView; Now, I need to figure out the code-signing and provisioning to get it on my old phone, but that's another story.