starwar2012 2013-01-23 02:06 采纳率: 0%
浏览 5162

iphone-UIButton中的动画gif

我写的代码运行之后,160*148尺寸的图片变的非常大,全屏了……

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

这个应该怎么解决?

  • 写回答

3条回答

  • 睡觉不盖被 2015-08-24 15:36
    关注

    楼主在初始化UIImageView的尺寸时 是否设置错了frame

    评论

报告相同问题?