I was wondering if I should use an nsdictionary to hold all of the values that my program uses. Or, I could stick with 开发者_JS百科using many variables for each value.
If I use an NSDictionary/array I could release it all at once, rather than a bunch of variables. Unfortunately I am dealing with many memory leaks, so I thought that using an NSdictionary/array could help with the memory leaks.
I guess it depends a bit on your application, but I would highly recommend that you look into Object Oriented Programming instead of using arrays, variables, etc.
I mean, technically, you'd still have those, but you would have an array of objects that would contain the variables you need, and it would know how to save itself if you implement the correct methods.
Misusing is always bad; only use NSDictionary/arrays when you need container. Better read docs and avoid memory leaks as the rest of us avoid them: write proper code.
精彩评论