Search Results

Search found 2 results on 1 pages for 'mikeyward'.

Page 1/1 | 1 

  • static NSStrings in Objective-C

    - by MikeyWard
    I frequently see a code snippet like this in class instance methods: static NSString *myString = @"This is a string."; I can't seem to figure out why this works. Is this simply the objc equivalent of a #define that's limited to the method's scope? I (think) I understand the static nature of the variable, but more specifically about NSStrings, why isn't it being alloc'd, init'd? Thanks~

    Read the article

  • Cocoa Singleton conventions

    - by MikeyWard
    Cocoa is full of singletons. Is there a logical/conventional difference between when the Cocoa APIs use NSSingletonObject *so = [NSSingletonObject defaultSingleton]; versus NSSingletonObject *so = [NSSingletonObject sharedSingleton]; ? Not a huge thing, but I don't really see why sometimes one is used versus the other.

    Read the article

1