Search code examples
iphonecocoadrawingquartz-graphicsequations

DRAW (print - not the graph) an equation in Quartz (iPhone SDK)


I'm trying to draw equations to the screen. Not the graphs or sth just the equation, but in a "pretty" way (f.e. like they look on wikipedia ). I've done some research but could find a "build-in-way", but maybe i overlooked something?!?

So i've decided to draw them by myself. I'm not very experienced, so don't blaim me if my idea is completely idiotic...

I thought of two ways. Either i create one UIView subclass hand in the formula as string, parse it and handle all the drawing in that view. Or i create individual subclasses for each type of mathematical expression and hand in the apropriate parts (f.e numerator and denominator for a fraction). and those parts can be either of those subclasses... f.e. a (square)-root-subclass would get the part under the root and draws the root-sign at the appropriate place in the appropriate size...

is one of this ways any good? or if some knows an better/easier way to solve this, pls let me know.

would help me alot, thanks


Solution

  • Just pour a MathML expression into a UIWebView.