After
I am using this code to create some items and then store them in an array {Pre int ( ii = 0; iy & lt; 5; iy ++} for Some questions. You are creating 25 object instances, not more than one, No, ARC takes care of memory management for you. A nitpick: Assume that
{int ix = 0; z & lt; 5; z ++} {TerrainHex * myObject = [[ TerrainHex alloc] initWithName: (@ "grassHex example 10000") Width: MGameWidth height: mGameHeight index: ix index: iy]; MyObject.myImage.y + = 100; [Terrain hexarered object: myobacter]; [Self Combined: (id) myObject.myImage]; }} NSLog (@ "% lu", size (TerrainHexArray));
sizeof () Variable is
TerrainHexArray which (probably) tells the size of the indicator byte for an NSMutableArray. Assuming 32-bit systems, pointers are 32 bits which are 4 bytes. Instead you should use
[TerrainHexArray count] . This is the method that gives the number of objects in the array.
myObject is just a variable that holds a pointer for a given object . By working, the object to change it is not erased before it pointed out (though the ARC takes care of it).
TerrainHexArray is an example of NSArray, then you should not capitalize the first letter. This language is not required, but it is a conference to redeem class names, but they use a lower case first letter for variable names.
terrainHexArray will be more appropriate and will make the code more readable.
Comments
Post a Comment