what is the difference between UIView and NSView
One other big difference is where the origin of the coordinates system is.
In NSView 0,0 is in the lower left with positive values of Y going up.
In UIView 0,0 is in the top left with positive values of Y going down.
UIView is used on iOS (Cocoa Touch), NSView on Mac (Cocoa). Although they have a lot in common, under the hood there are a lot of differences. For example, a UIView is always backed by a CoreAnimation layer while a NSView is only if you explicitly call setWantsLayer:YES
(and optionally provide your own layer before that). For more details, refer to the class references for UIView and NSView.
NSView is IMHO more complicated and has more features due to its legacy (the first version of NeXTStep was released in 1988, so NSView's original design was created in 1988 at the latest). Some features wouldn't make sense on iOS (like drag&drop and tooltips). UIView was a fresh start (in 2006 at the latest) and avoided some design problems of NSView (for example, as mentioned earlier, it's always using CoreAnimation backing instead of the three modes that NSView supports). It has a different feature set also because its used in a different environment (see multitouch support; wouldn't make sense in NSView).
UIView is on the iPhone, NSView is not. Hence, NSView is for Mac Applications, UIView is for iPhone apps.
UIView is used for Cocoa Touch (Framework for iOS devices) whereas NSView is used for Cocoa (Mac OS X)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With