Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using UIGraphicsGetCurrentContext in MarkerImage subclass #2835

Closed
mikaelhellqvist opened this issue Sep 29, 2017 · 1 comment
Closed

using UIGraphicsGetCurrentContext in MarkerImage subclass #2835

mikaelhellqvist opened this issue Sep 29, 2017 · 1 comment

Comments

@mikaelhellqvist
Copy link

Hi Daniel,

thanks for an awesome library!

I've subclassed MarkerImage in order to show images where ever I want on the graph. I think this is the way to do it.

Although let context = UIGraphicsGetCurrentContext() always returns nil. Do you have any suggestions?

@liuxuan30
Copy link
Member

liuxuan30 commented Oct 13, 2017

Declaration
CGContextRef UIGraphicsGetCurrentContext(void);
Return Value
The current graphics context.

Discussion
The current graphics context is nil by default. Prior to calling its drawRect: method, view objects push a valid context onto the stack, making it current. If you are not using a UIView object to do your drawing, however, you must push a valid context onto the stack manually using the UIGraphicsPushContext function.

Check your class first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants