I am making an app that uses a class I will call Player the number of Player instances can go up to 10 and down to 2. I am wondering what is the best way to keep track of all of these instances? For now I am just making an array in my view controller that I can add to and remove f开发者_运维技巧rom as necessary, but is there a better way? I was wondering if there is such a thing as class variables as there are class methods?
Thanks in advance.
I discovered that what i needed to do was create another object to manage my child objects. ie Players keeps track of each player instance. I'm new to this OOP world but I think Im figuring things out.
In objective-C the static methods are called as class methods. They all will be called by the class name.
eg:
+(void)classMethod
{
}
[Class classMethod];
You can synchronize properties for your class variables and then use them.
精彩评论