0

I have an XML for a line I drew, the task is to create a simple iOS app and take that XML file and draw the same line in the app. Have you done it before? If so what tools did you use, and can you give an overall idea of how to start. Thanks

Rob
  • 415,655
  • 72
  • 787
  • 1,044
Alex
  • 147
  • 12
  • You can parse your XML with `NSXMLParser`, and create a path that you'll draw. Regarding drawing the line, I think it's easiest to create a `UIBezierPath`, using that to specify the `path` property for a `CAShapeLayer`, which you'll then add as a sublayer to your view's layer. You can also write your own `UIView` subclass, whose `drawRect` method will call the Core Graphics functions to stroke a path. This illustrates the two drawing techniques: http://stackoverflow.com/questions/16846413 – Rob May 28 '14 at 15:03
  • This question should probably be closed, though, as it's a little broad. I'd suggest you do a little research on the above topics, and try a few of those techniques (e.g. use `NSXMLParser` to confirm you can successfully parse the XML, try drawing a few lines, etc.). Good luck! – Rob May 28 '14 at 15:07
  • ok, that sounds like a lot to digest right now, I just started iOS dev. I will go over those ideas and will try to get it to work. Thanks – Alex May 28 '14 at 15:17
  • Agreed. Just tackle them one at a time, and the problem becomes more tractable. First see if you can get XML parsing working (without any drawing of lines). Then tackle the line drawing with `CAShapeLayer`. Good luck! – Rob May 28 '14 at 15:25

0 Answers0