the objective of this code is to automatically create an object and animate it to move across screen. once it reaches x at 120 then it is deleted. the problem I am facing is that i can not get the frame and there for the x value from the object in the array. here is my code, any suggestions?
- (void)AddRight{
Bullets= [[NSMutableArray alloc] init];
CGRect frame = CGRectMake(480, 180, 60, 55);
Bullets = [[UIImageView alloc] initWithFrame:frame];
Bullets.image=[UIImage imageNamed:@"Bullet.png"];
[self.view addSubview:Bullets];
[Bullets addObject:theBullet];
for (int x = 0; x < [Bullets count]; x++) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDelegate:self];
[theBullet setFrame:CGRectMake(265, 180, 60, 55)];
[UIView commitAnimations];
}
} and the detection is here:
for (int x = 0; x < [Bullets count]; x++) {
NSObject *bull = [[LeftBees objectAtIndex:x]];
CGRect frame = bull.frame;
if (frame.origin.x>120) {
[bull removeFromSuperview];
}
}
the "CGRect frame = referal.frame;" has ther error saying "Property frame is not part of NSObject"
NSObject
. – DrummerB Oct 3 '12 at 20:10