ios - Show Blended Layers reveals red UIImage but it does not have an alpha channel -
i have image not have alpha channel - confirmed in finder's info panel. yet when put in uiimageview
within uiscrollview
, enable show blended layers, image red indicates it's trying apply transparency hit on performance.
how can fix green ios knows in view opaque?
i tried following did not remove red color:
self.imageview.opaque = yes; self.scrollview.opaque = yes;
by default, uiimage
instances rendered in graphic context includes alpha channel. avoid it, need generate image using new graphic context opaque = yes
.
- (uiimage *)optimizedimagefromimage:(uiimage *)image { cgsize imagesize = image.size; uigraphicsbeginimagecontextwithoptions( imagesize, opaque, scale ); [image drawinrect: cgrectmake( 0, 0, imagesize.width, imagesize.height )]; uiimage *optimizedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return optimizedimage; }
Comments
Post a Comment