从NSMutablearray xcode中的对象获取帧

时间:2012-10-03 20:08:30

标签: xcode arrays nsmutablearray frame

此代码的目标是自动创建一个对象并使其动画化以在屏幕上移动。一旦它达到120在120,那么它将被删除。我面临的问题是,我无法获取框架,并在那里获取数组中对象的x值。这是我的代码,有什么建议吗?

- (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];
}

} 检测在这里:

for (int x = 0; x < [Bullets count]; x++) {
        NSObject *bull = [[LeftBees objectAtIndex:x]];
       CGRect frame = bull.frame;
        if (frame.origin.x>120) {
            [bull removeFromSuperview];
        }
    }

“CGRect frame = referal.frame;”有错误说“属性框架不是NSObject的一部分”

0 个答案:

没有答案