objective c - Pointer to a property in singleton -


nsmutabledictionary *searchfilters = [globaldata instance].searchfilters; if([searchfilters count] == 0) {     nslog(@"no more keys, destroy global filters");      [globaldata instance].searchfilters = nil; // okay      // searchfilters = nil; <-- not okay } 

hi guys, can me understand better pointers in objective c? shown above, have dictionary property stored in singleton called 'globaldata', using pointer *searchfilters can point dictionary , read values correctly, but, if want modify value, code 'searchfilters = nil' not modify value in global singleton @ all.

i need shortcut [globaldata instance].searchfilters not need retype "[globaldata instance].searchfilters" each time... pointer, pointer pointer, watever, want know there wat address property in singleton faster.

your pointer searchfilters pointing same location [globaldata instance].searchfilters, it's not same pointer, created alias.

so searchfilters = nil assigning nil alias created, original pointer remains untouched.

this same behaviour in c :)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -