Question: Is it dangerous to cast "(NSInteger)self"?

I need to distinguish two views, not using tag value.

If It is dangerous, any ideas?

Answer: 
Ignoring what convulsions ARC may go through, it's not dangerous to cast `self` (or any other pointer) to `integer`. It is exceedingly dangerous, however, to cast the other direction.

And Objective-C has enough odd corners and dark hallways that it's difficult to say with great confidence that `self` cast to an integer will be reproducible in a useful way.
The `NSObject` protocol declares an [`isEqual:`](http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/doc/uid/20000052-BBCCECDG) method for comparing objects. A class can override this to define its instances as equal if their contents are equal; otherwise two instances will compare as unequal.

This is what you should really use to distinguish objects from each other, rather than comparing their pointer values directly. That is, however, safe to do.