touchesEnded Sound?
        Posted  
        
            by NextRev
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by NextRev
        
        
        
        Published on 2010-03-25T14:27:42Z
        Indexed on 
            2010/04/30
            3:47 UTC
        
        
        Read the original article
        Hit count: 367
        
I'm trying to play a sound on touchesEnded but I'm having a problem. There are multiple objects that get moved around, so if the below code holds true when any object is moved, it constantly plays the sound. How do I only play it once?
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    if(CGRectContainsRect([image1 frame], [image2 frame])){
        [self playsound];
    }
}
        © Stack Overflow or respective owner