Objective C creating custom arrays -


In other languages, I can create a square, then use this which is used in the price of the class such as the square To define the prices of a price [] in a display class to make the chain of ;?

In Objective-C, I can not do this work, how do you do it?

Price class is the inheritor of NSObject, can I use NSMutableArray?

You have a square value, and it then inherits you from NSObject, then an array of them is an NSArray Or NSMutableArray. You can also store them in a single array, or an STL vector, though memorymanagement sematics may be difficult in those cases.

In the case of NSArray / NSMutableArray, a proprietary reference on the array takes the object, you can continue it after adding it to the array, and it will remain in memory until this array (and all other locations On)

Code may take:.

  NSMutableArray * a = [NSMutableArray array]; [An add object: [price price]]; // and / or [an add object: [[[value aloch] int] autores]; // and / or value * p = [[value aloch] init]; [An add object: p]; [P release]; NSLog (@ "array is% @", a); // This point you have not created "self" one, then you keep it, or use the above  for [NSMutableArray new] 

when issued a Remember, all value items want to be included in it (and potentially distributed).


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -