how do you declare NSUser defualts

Discussion in 'iOS Programming' started by Programmer, Sep 25, 2009.

  1. Programmer macrumors member

    Programmer

    Joined:
    Jun 16, 2009
    #1
    i have been trying to declare an NSUserdefualt in my app for a few hours and i am starting to get really frustrated. How do you set the NSUserdefualt up?
     
  2. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #3
    instead of writing something like the following several times in methods throughout a class:
    Code:
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    
    you could simply define it at the beginning of your class:
    Code:
    #define kDefaults [NSUserDefaults standardUserDefaults]
    
     
  3. MacDonaldsd macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #4
    True, I don't like using constants like that though :)

    Personal choice though.
     
  4. Programmer thread starter macrumors member

    Programmer

    Joined:
    Jun 16, 2009
    #5
    but...

    but how do declare the stuff you want to set as your NSUserdefault
     
  5. Menge macrumors 6502a

    Menge

    Joined:
    Dec 22, 2008
    Location:
    Amsterdam
    #6
    MacDonaldsd posted the answer for this very early in this thread... just read.
     

Share This Page