【Determining Equality of Objects】
If you need to determine whether one object is the same as another object, it’s important to remember that you’re working with pointers. The standard C equality operator == is used to test equality between the values of two variables, like this:
When dealing with objects, the == operator is used to test whether two separate pointers are pointing to the same object:
If you need to test whether two objects represent the same data, you need to call a method like isEqual:, available from NSObject:
If you need to compare whether one object represents a greater or lesser value than another object, you can’t use the standard C comparison operators > and <. Instead, the basic Foundation types, like NSNumber, NSString and NSDate, provide a compare: method: