这就是我得到的,但是我在图片中看到了错误。 我有用于UIImageView * bottomGroundContinue的IBOutlets和用于* bottomGround的IBOutlets @implementation viewController
@property (nonatomic, assign) BOOL keepGoing;
@property (nonatomic, strong) UIImageView *bottomGround;
@property (nonatomic, strong) UIImageView *bottomGroundContinue;
- (void)getReady {
UIImage *theImage = [UIImage imageNamed:@"bottomGround.png"];
self.bottomGround = [[UIImageView alloc] initWithImage:theImage];
self.bottomGroundContinue = [[UIImageView alloc] initWithImage:theImage];
self.bottomGround.frame = self.view.bounds;
self.bottomGRoundContinue.frame = CGRectOffset(self.view.bounds, self.bottomGround.bounds.size.width, 0.0);
[self.view addSubview:self.bottomGround];
[self.view addSubview:self.bottomGroundContinue];
self.keepGoing = YES;
}
- (void)go {
CGFloat width = self.bottomGround.bounds.size.width;
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
self.bottomGround.frame = CGRectOffset(self.bottomGround.frame, -width, 0);
self.bottomGroundContinue.frame = CGRectOffset(self.bottomGroundContinue.frame, -width, 0);
} completion:^(BOOL finished) {
if (self.keepGoing) {
// now B is where A began, so swap them and reposition B
UIImageView *temp = self.bottomGround;
self.bottomGround = self.bottomGroundContinue;
self.bottomGroundContinue = temp;
self.bottomGroundContinue.frame = CGRectOffset(self.view.bounds, self.view.bounds.size.width, 0.0);
// recursive call, but we don't want to wind up the stack
[self performSelector:@selector(go) withObject:nil afterDelay:0.0];
}
}];
}
答案 0 :(得分:0)
您正在声明@implementation中的属性。你需要在@interface中声明它们。