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: 
You mean you have two `UIView` pointers and you want to know if they are pointing to the same object? Just use `==`. No need to cast them. If you mean something else, you'll need to provide more details on what you mean by "distinguishing two views".
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.