ios - Cannot get correct UIColor in rectangle -


all,

i have piece of code :

- (void)drawrect:(cgrect)rect {     cgcontextref context = uigraphicsgetcurrentcontext();     cgcontextsetfillcolorwithcolor(context, [uicolor redcolor].cgcolor);     cgcontextfillrect(context, cgrectmake(0, 440, 320, 30)); 

and call :

_rectangeview = [[popuprectangle alloc] initwithframe:cgrectmake(0, 538, 320, 30)]; 

but black!

anyone advice why ?

change colouring rect this...

cgcontextfillrect(context, cgrectmake(0, 0, 320, 30)); 

use 0, 0 origins not 0, 440.

that should work.

inside drawrect dealing in vector space of view not superview. 0, 0 top left of rectangleview.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -