1

私はこのコードを使用します。実際には画像のサイズは 160x148 ですが、画像ボタンはすべての画面で非常に大きく表示されます。

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];

それをどのように修正しますか?

4

2 に答える 2

2

initWithFrame:ビューの境界を呼び出して通過したため、画像は大きくなります。次のような別のサイズの四角形に変更します。

CGRectMake(0, 0, 160, 148)

...次に、適切と思われる位置に再配置します。

于 2013-01-22T19:18:06.023 に答える
0

このコードを試してください。正しい解決策に役立ちます。

 UIImage *myimage=UIImage imageNamed:@"button1.png";
Button.imageview.image=myimage;
于 2013-01-24T06:49:55.223 に答える