0

I am new to Objective C and I am trying to make a basic puzzle game. I am using multiple UIImage objects, some labels and a button. It consists in moving the pieces to its correct position. If the user fails to put a piece in a place, the piece goes back to its original location.

That part works perfectly, the problem begins once I 'remove' that view and continue on the other screens. Whenever I click ANYWHERE on screen the views get multiplied endlessly. Why is that happening?

What should I do?, I am so desperate, I've tried almost everything including ignoring touches, blocking touches, etc. And this only creates more trouble.

I have already tried setting using interactions to no, ignoring interaction events, autoreleasing the view, and I have not reached a solution.

Any help will be very much appreciated. Greetings!

---> I tried posting an image but given that I am a newbie I wasn't able to, however I can send the image to anyone if needed to show you the weird effect I get.

-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
    [self touchesCancelled:touches withEvent:event];
}

-(IBAction) navigationConversation: (id)sender{
    //[self.view.superview setUserInteractionEnabled:NO];
    //[[UIApplication sharedApplication] endIgnoringInteractionEvents];
    if (nextButton.hidden == NO) {
        conversation *navigationConversationController=[[conversation alloc]     initWithNibName:@"conversation" bundle:nil];
        [self.view addSubview:navigationConversationController.view];
        if (self.view.superview == nil)
            [navigationConversationController autorelease];
    }
    return;
}
paqolp
  • 1
  • 2

1 Answers1

0

Thank God, the problem is solved now. This are the changes I made, and this corrected the mistake. :)

-(IBAction) navigationConversation: (id)sender{
    if (nextButton.hidden == NO) {
        //I disabled the interactions with the puzzle view in here, thus eliminating the problem
        [self.view.superview setUserInteractionEnabled:NO];
        conversation *navigationConversationController=[[conversation alloc]     initWithNibName:@"conversation" bundle:nil];
        [self.view addSubview:navigationConversationController.view];
        if (self.view.superview == nil)
            [navigationConversationController autorelease];
    }
    return;
}

Thanks to everyone who looked! and wanted to help! I hope this works for other people having the same issues.

paqolp
  • 1
  • 2