An object that manages image data in your app.
Overview. Image views let you efficiently draw any image that can be specified using a UIImage object. For example, you can use the UIImageView class to display the contents of many standard image files, such as JPEG and PNG files.
Call [img drawInRect:rect];
.
BTW, you shouldn't load the image file in the drawRect method. Because the method is called whenever the view is required to update. Therefore, it (of course, loading procedure) may be called many many times during running. (Furthermore, OS2.x's imageNamed method has a bug -- not cached the image and leaked it.)
Therefore, you'd better to load the file in the initialization method, not in the drawRect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With