0

I'm creating a custom progress bar and I've spliced it up into 1px images. If the progress bar were 100px wide then I would need 100 UIImageViews to fill the progress bar. The problem is this very quickly slows the iPhone down. How can I reuse an image view?

Anthony

Anthony Frizalone
  • 589
  • 1
  • 6
  • 15

2 Answers2

1

Make your own UIView subclass and then draw the images onto it yourself in the drawRect message. Look at this

How to draw an UIImage or directly in -drawRect:?

Community
  • 1
  • 1
Lou Franco
  • 87,846
  • 14
  • 132
  • 192
0

Create The imageView in Xib (Not in View)

Create it's IBOutlet (Suppose Named MyImage) And Try

For(int i=0;i<100;i++) 
{
    UIImageView *img=[[UIImageView alloc]init];
    img.frame=CGRectMake(i,100,1,1);
    img.image=MyImage.image;
    [self.View addSubView:img];

}
interjay
  • 107,303
  • 21
  • 270
  • 254