2012-01-12 6 views
3

UIImageView의 애니메이션 및 크기를 조정하려면 어떻게해야합니까? 나는이 일을 시도하고 나를 위해 작동하지 않았다애니메이션 및 크기 조정 UIImageView

[UIView beginAnimations:nil context:NULL]; 
      [UIView setAnimationDuration:1.0]; 
      imgView.frame = CGRectMake(0, 0, 320, 480); 
      [UIView commitAnimations]; 
+0

어떤 일이 발생하지 않았다

시도 imgView.frame는로 설정하는 방법? 'imgView'의 시작 프레임은 무엇입니까? 이걸 어디서하고 있니? 우리는 더 많은 정보가 필요합니다. –

답변

5

는 블록 애니메이션을 사용해보십시오 : 도움

[UIView animateWithDuration:1.0f // This can be changed. 
       animations:^{ 
        CGRect frame = imageView.frame; 
        frame.size.width += 100.0f; // This is just for the width, but you can change the origin and the height as well. 
        imageView.frame = frame; 
       } 
       completion:^(BOOL finished){ 
       }]; 

희망을!

-1

// UIImageView를 설정하십시오. 프레임은 이미지의 위치와 크기를 결정합니다. UIImageView * i = [[UIImageView alloc] initWithFrame : [CGRectMake (50.0,50.0,50.0,50.0)]];

// i.images = UIImageView에 이미지를 추가 [[NSArray를의 ALLOC] initWithObjects을 : [있는 UIImage imageNamed을 : @ "1.png"],
[있는 UIImage imageNamed을 : @ "2.png"를, 전무] ;

// 애니메이션을 실행할 시간을 설정하십시오. i.animationDuration = 1.0f;

// 애니메이션 시작 [i startAnimating];

촬영 된 이미지

i.frame CGRectMake = (x, y, 폭, 높이)의 구조를 변경하여 이미지의 크기를 조정할 수있다;

0

이 코드를 사용해보십시오. 우리는 당신이 imgView에 대한 올바른 참조가 있다고 가정하면이

 CGPoint newLogoutCenter = CGPointMake(160, 364); 
    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:1.0f]; 
    twitterBarVIew.center = newLogoutCenter; 
    [UIView commitAnimations]; 
0

, 나를 위해 잘 작동, 다음은 imgView의 프레임을 시작하기 전에 애니메이션 후 같은 것 같다.

imgView.frame = CGRectMake(100,100,100,100); 
관련 문제