0

iOSアプリで画像スライドダウンアニメーションを実装するにはどうすればよいですか?

私はこのコードを使用しました:

    imageview.animationImages = [NSArray arrayWithObjects:
                                 [UIImage imageNamed:@"img10.png"],
                                 [UIImage imageNamed:@"img11.png"],[UIImage imageNamed:@"img12.png"],[UIImage imageNamed:@"img13.png"],nil];
    imageview.animationDuration = 10.00;  

    imageview.animationRepeatCount = 0; 

    [imageview startAnimating];

ただし、これは単純なスライド ショーにすぎません。助けて。

4

3 に答える 3

0

このコードで試してください。

      imageview = [[UIImageView alloc] initWithFrame:self.view.frame];
      imageview.animationImages = [NSArray arrayWithObjects:
                             [UIImage imageNamed:@"img10.png"],
                             [UIImage imageNamed:@"img11.png"],[UIImage imageNamed:@"img12.png"],[UIImage imageNamed:@"img13.png"],nil];

        imageview.animationDuration = 1.25;
        imageview.animationRepeatCount = 10;
        [imageview startAnimating];
        [self.view addSubview:animationView];
        [imageview release]; 
于 2012-11-23T11:13:10.613 に答える
0

UIImageViewimgVw.centreを使用して中心を変更したり、中心を更新したりできますNSTimer。画面に応じて中央を変えると、画面の高さを取得できます
[[UIScreen mainScreen]bounds].size.height

theTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f 
        target:self 
        selector:@selector(updateTimer:) 
        userInfo:nil 
        repeats:YES];

- (void)updateTimer:(NSTimer *)theTimer {
    //update centre; 
    imgVw.centre.y += 4;
// you can update the image also if needed use if case
imgVw.image = image2;

}
于 2012-11-23T11:27:49.387 に答える
0

次のコードを試してください

   -(void) createNewImage {
        imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,460)];

        imageView.animationImages = [NSArray arrayWithObjects:
                                 [UIImage imageNamed:@"img10.png"],
                                 [UIImage imageNamed:@"img11.png"],
                                 [UIImage imageNamed:@"img12.png"],
                                 [UIImage imageNamed:@"img13.png"],nil];
        [imageView setAnimationRepeatCount:10];
        imageView.animationDuration =1.5;
        [imageView startAnimating]; 
        [NSTimer scheduledTimerWithTimeInterval:15.0 target:self selector:@selector(setLastImage:) userInfo:nil repeats:NO];

     }

    -(void)setLastImage:(id)obj
    {
        [imageView performSelectorOnMainThread:@selector(setImage:) withObject:[UIImage imageNamed:@"img12.png"] waitUntilDone:YES];
    }
于 2012-11-23T11:14:04.400 に答える