이 코드를 사용하면 이미지 160x148의 실제 크기가 작동하지만 이미지 버튼이 모든 화면에서 매우 크게 볼 수 있습니다!uibutton의 애니메이션 GIF
UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"button1.png"],
[UIImage imageNamed:@"button2.png"],
[UIImage imageNamed:@"button3.png"],
[UIImage imageNamed:@"button4.png"], nil];
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[yourButton addSubview: animatedImageView];
수정 방법은 무엇입니까?
initWithFrame :을 (를) 호출하여보기의 경계를 넘어서서 매우 좋습니다. 다른 크기의 rect로 변경하십시오. – Luke
어떻게 그럴 수 있습니까? – user1996717
적어도 self.view.bounds를 CGRectMake (0, 0, 160, 148)로 변경 한 다음 필요에 따라 위치를 변경합니다. – Luke