iphone - Drawing a DOT within a cells UIImageView's UIImage -


currently, attempting draw simple dot inside of cell's uiimageview's uiimage. attempting accomplish same thing calendar application iphone has when event represented calendar.

[[event calendar] cgcolor]  

is ekevent object logs uidevicergbcolorspace 0.509804 0.584314 0.686275 1

i attempt create small dot color [[event calendar] cgcolor]. heres trying do:

cgcontextref contextref = uigraphicsgetcurrentcontext(); cgcontextsetfillcolorwithcolor(contextref, [[event calendar] cgcolor]); cgcontextaddellipseinrect(contextref,(cgrectmake (12.f, 5.f, 4.f, 5.f))); cgcontextdrawpath(contextref, kcgpathfill); cgcontextstrokepath(contextref); cell.imageviewpic.image = uigraphicsgetimagefromcurrentimagecontext(); 

but here errors i'm getting:

 myscheduler[21445] <error>: cgcontextsetfillcolorwithcolor: invalid context 0x0  myscheduler[21445] <error>: cgcontextaddellipseinrect: invalid context 0x0  myscheduler[21445] <error>: cgcontextdrawpath: invalid context 0x0  myscheduler[21445] <error>: cgcontextdrawpath: invalid context 0x0 

i don't understand i'm doing wrong... why context invalid?

as see, you're trying image of drawing , add imageviewpic. here's should working:

uigraphicsbeginimagecontext(cgsizemake(5.0f,5.0f));  cgcontextref contextref = uigraphicsgetcurrentcontext(); cgcontextsetfillcolorwithcolor(contextref, [[event calendar] cgcolor]); cgcontextfillellipseinrect(contextref,(cgrectmake (0.f, 0.f, 5.f, 5.f))); uiimage *drawingimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();  cell.imageviewpic.image = drawingimage; 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -