0

我是 Objective C 的新手,我正在尝试制作一个基本的益智游戏。我正在使用多个 UIImage 对象、一些标签和一个按钮。它包括将碎片移动到正确的位置。如果用户未能将一块放在某个地方,则该块将回到其原始位置。

该部分完美运行,一旦我“删除”该视图并在其他屏幕上继续,问题就开始了。每当我点击屏幕上的任何地方时,视图都会无限增加。为什么会这样?

我该怎么办?,我很绝望,我已经尝试了几乎所有的方法,包括忽略触摸,阻止触摸等。这只会造成更多的麻烦。

我已经尝试将使用交互设置为否,忽略交互事件,自动释放视图,但我还没有找到解决方案。

任何帮助将不胜感激。问候!

---> 我尝试发布图片,但鉴于我是新手,我无法发布,但是如果需要,我可以将图片发送给任何人,以向您展示我得到的奇怪效果。

-(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;
}
4

1 回答 1

0

感谢上帝,现在问题已经解决了。这是我所做的更改,这纠正了错误。:)

-(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;
}

感谢所有看过的人!并想帮忙!我希望这适用于其他有同样问题的人。

于 2012-06-27T08:18:03.903 回答