Liang's Blog

Dont worry,be happy.

Isequal == 区别

| Comments

事情虽小有的人真愿意去做。

1
2
3
4
5
6
7
8
9
10
11
- (BOOL)isEqual:(id)object {  
// By default, if two variables point to the same object in memory, it should always be // equal  
    if (object == self) {  
        return YES;   
    }  
    if (![object isKindOfClass:[MyItem class]]) {   
        return NO;  
    }  
    MyItem *myItem = (MyItem *)object;  
    return [myItem.identifier isEqual:self.identifier];   
}  

上边便是isequal的方法内容,可以看出==判断也包含在其中。

原文链接: http://blog.csdn.net/devday/article/details/7594669

Comments