It creates an image and animates it... while it is animation it moves to the other corner basically... the image is not appearing at all... it worked before I added the array in so im guessing theres something wrong with the array maybe placement because all code seems to be logical... also if i replace the entire array with just something like UIImage *image = [UIImage imageNamed
"x"]; it works fine.. thanks
Code:
int x = arc4random()%5+1;
UIImage *one = [UIImage imageNamed:@"1.png"];
UIImage *two = [UIImage imageNamed:@"2.png"];
UIImage *three = [UIImage imageNamed:@"3.png"];
UIImage *four = [UIImage imageNamed:@"4.png"];
UIImage *five = [UIImage imageNamed:@"5.png"];
UIImage *six = [UIImage imageNamed:@"6.png"];
UIImage *seven = [UIImage imageNamed:@"7.png"];
UIImage *eight = [UIImage imageNamed:@"8.png"];
UIImageView *alienFlyer = [[UIImageView alloc]init];
alienFlyer.animationImages = [NSArray arrayWithObjects:
one,
two,
three,
four,
five,
six,
seven,
eight, nil];
alienFlyer.animationDuration = 1;
alienFlyer.animationRepeatCount = -1;
[alienFlyer setFrame:CGRectMake((-alienFlyer.bounds.size.width)-1, ((self.view.bounds.size.height)-(alienFlyer.bounds.size.height))/2, alienFlyer.frame.size.width, alienFlyer.frame.size.height)];
[self.view addSubview:alienFlyer];
[alienFlyer startAnimating];
CGRect theMoveToPosition = CGRectMake(((self.view.bounds.size.width)+(alienFlyer.bounds.size.width))+1, ((self.view.bounds.size.height)-(alienFlyer.bounds.size.height))/2, alienFlyer.frame.size.width, alienFlyer.frame.size.height);
[UIView animateWithDuration:x delay:0 options:UIViewAnimationOptionTransitionCurlUp
animations:^ {
alienFlyer.frame = theMoveToPosition;
}completion:^(BOOL finished) {
if (finished) {
[alienFlyer removeFromSuperview];
}
}];
}
Last edited by a moderator: