views:

165

answers:

1

In Java you can write an if statement like this:

if(object1.equals(object2)){ // Do something.... }

How can I code the same logic in Objective-C? I basically want to compare 2 of any one type of objects, such as 'Text Fields', 'Text Views', etc.

Thank you.

Shakeel

+6  A: 

It's pretty similar!

if ([object1 isEqual:object2])

see the NSObject protocol documentation.

deanWombourne