Question

I use this code, that work, really size of image 160x148 but image button is view very big on all screen!

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

How fix that?

Was it helpful?

Solution

The images are big because you called initWithFrame: and passed in your view's bounds. Change it to a different-sized rect, such as:

CGRectMake(0, 0, 160, 148)

... and then reposition it as you see fit.

OTHER TIPS

Try this code.It will help you for correct solution.

 UIImage *myimage=UIImage imageNamed:@"button1.png";
Button.imageview.image=myimage;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top