NS to Ui Objects

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

  1. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    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?

    Thanks
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    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.)
    NSValue
    NSArray

    Example UIKIt Classes:
    UIButton
    UITextField
    UIImage

    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

    Joined:
    Apr 22, 2005
    #3
    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 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    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

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #5
    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

    Joined:
    Sep 8, 2006
    #6
    Thanks for the replies. There are some differences.

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

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #7
    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