views:

38

answers:

2

Why the NSArray allocated with arrayWithObjects dealloc automatically if already used by BObject object?? in teory NSArray must remain allocated all the BObject life time...

[[BObject alloc] initObjectName:@"oneObject" states:
   [NSArray arrayWithObjects:
    [[State alloc] initStateName:@"stand_front" singleImg:[NSArray arrayWithObjects:[UIImage imageNamed:@"front_1.png"], nil]],
    [[State alloc] initStateName:@"front_walking" frames:
     [NSArray arrayWithObjects:
      [UIImage imageNamed:@"front_1.png"],
      [UIImage imageNamed:@"front_2.png"],
      [UIImage imageNamed:@"front_3.png"],
      [UIImage imageNamed:@"front_4.png"],
      [UIImage imageNamed:@"front_5.png"],
      [UIImage imageNamed:@"front_6.png"],
      [UIImage imageNamed:@"front_7.png"],
      [UIImage imageNamed:@"front_8.png"], 
      nil] duration:0.8 repeat:0],
    nil]
   isSolid:TRUE];
A: 

The BObject probably makes a copy of the array, instead of retaining it.

Tom Dalling
+1  A: 

BObject must retain the array passed as states:

drawnonward