ios - Category on UIImage to return a blank UIImage? -


how create uiimage context can return it? want have transparent pixels. have different method adds smaller uiimages larger one, need blank slate begin with.

+ (uiimage *)blankuiimageofsize:(cgsize)size {     uigraphicsbeginimagecontextwithoptions(size, no, 1);      ...?     } 

the following should work:

+ (uiimage *)blankuiimageofsize:(cgsize)size {     uigraphicsbeginimagecontextwithoptions(size, no, 1);      cgcontextref ctx = uigraphicsgetcurrentcontext();     cgcontextclearrect(ctx, cgrectmake(0, 0, area.width, area.height));      uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext();      uigraphicsendimagecontext();      return newimage; } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -