NS to Ui Objects

Discussion in 'iOS Programming' started by larswik, Sep 2, 2011.

  1. larswik macrumors 68000

    Sep 8, 2006
    I have a little bit of experience in Objective-C but I am now digging into the ios. Most of the terminology I am use to is like NSImage but I notice that most things ios has a UI as in UIImage. Is that pretty much for everything like NSString is now UIString (guessing on that one), or can I still use NS?

  2. ArtOfWarfare macrumors G3


    Nov 26, 2007
    Foundation Classes are prefixed with NS while classes related to the User Interface Kit (UIKit) are prefixed with UI.

    Example Foundation Classes:
    NSString (You're incorrect in assuming this would be called a UIString.)

    Example UIKIt Classes:

    I didn't program for the Mac much as the first iOS Dev Kit was released shortly after I began learning how to program, but it's my understanding that many methods for UI classes on a Mac have the same name as their UIKit counterparts on iOS.

    I tend to think of Foundation Classes as being more abstract classes, if that's any help.
  3. admanimal, Sep 2, 2011
    Last edited: Sep 2, 2011

    admanimal macrumors 68040

    Apr 22, 2005
    Be careful with your terminology, as abstract class has a specific meaning, which is not what you're talking about. Foundation classes are exactly that: fundamental classes that provide the foundation for more complicated classes by providing basic data structures like arrays, strings, dictionaries, etc.
  4. ArtOfWarfare macrumors G3


    Nov 26, 2007
    How about Foundation Classes are more akin to models? Like, in MVC, an NSString is a model whereas a UILabel is the view? Maybe I should just take out my line about comparing them to anything and just leave my list of examples of each type...
  5. xStep macrumors 68000

    Jan 28, 2003
    Less lost in L.A.
    Look through the equivalent classes like NSImage and UIImage and you find that they have many differences. Off hand I'm thinking about the properties and methods. Also, the origin is not in the same place.
  6. larswik thread starter macrumors 68000

    Sep 8, 2006
    Thanks for the replies. There are some differences.

    [textField setStringValue:mad:"Hello"];
    [textField setText:mad:"Hello"];
  7. jiminaus macrumors 65816


    Dec 16, 2010
    There are lots of differences, that's why Apple changed the names of the classes.

    You're dealing with UIKit now, not AppKit. When Apple created UIKit for iOS (as part of Cocoa Touch), it looks like they took the opportunity to redesign the kit.

Share This Page