Quote:
Originally Posted by Domele
The object isn't allocated. Objects need to be allocated before they can be used.
Code:
NSMutableArray *mArray = [[NSMutableArray alloc] init];
Now, since you called alloc, you own the object and you are responsible for releasing it.
|
Thank you
it was really just that simple mistake
another question:
I know that it is not possible to add the same object twice, but how do i define a new name for the second object to add it?
I try to add the same object every touch event.
Code:
-(void)touchesBegan:(NSSet *) touches withEvent:(UIEvent *)event {
CGRect points = CGRectMake(start.x, start.y, 50.0f, 50.0f);
theImageView = [[UIImageView alloc] initWithFrame:points];
}
-(void)touchesEnded:(NSSet *) touches withEvent:(UIEvent *)event {
[theArray addObject:theImageView];
}
The array count is not getting higher than 1.