Aprove answer

you can replace your code on this if ([self.image2 superview] == nil)


You are comparing an UIView* with an integer (0) - of course you get a warning. Do you want to check whether the superview is nil? Then just do that:

if([self.image2 superview] == nil) { ... }

Credit Goes to: stackoverflow.com

Related question with same questions but different answers