since you are using [super dealloc]
I guess your project is non-ARC. In that case, when you create xImg
and oImg
with -imageNamed
you do not retain them (and in -dealloc
you do release them. Maybe, you should read more properly about memory management in iOS?). So in -touchBegan
you are accessing deallocated objects, which cause error. Use instead
oImg = [[UIImage imageNamed:@"O copy.jpg"] retain];
You can also convert your project to ARC by Edit -> Refactor -> Convert to ARC.
Also I highly recommend to use buttons to catch the touches, try to avoid copy-pasting code, and, as NSElvis mentioned, use && instead of &