Rapid Expansion leads to Asteroids
Week five has been a whirlwind, what with getting past the halfway mark and learning a new framework nearly every day. Since the Core Graphics session mid-week, we’ve also created re-imagined versions of the classic game Asteroids, for iOS. The one that my partner and I created was a bit of an App Academy Homage, with the spaceship being replaced by our teacher, Ned’s head, who shoots lasers from his eyes to zap the asteroids. This project taught us about Core Animation and how to conceptualize the model layer versus the presentation layer of objects on the screen. Every view object (because every view is an object) is associated with a CoreAnimation layer (or one can be created from it), which can then be acted on via QuartzCore. This allows you to animate a greater number of objects as the system can handle a lot more layer-objects than it can view-objects.
Friday we set out to create an “ImagePicker” app, that lets you take photos, send them to Parse, and retrieve them with a dynamic UITableView. This gave us a chance to see how you can work with your camera as a source for images in your app, and the implementation for this was surprisingly easy; it simply involves instantiating a UIImagePickerController (this is a class that you want to create an instance of) and then passing it a source type of “UIImagePickerControllerSourceTypeCamera” (Objective C and your catchy names) and voila, you can use pictures taken by the iPhone’s camera and before you know it, you’re the next Instagram, who incidentally could have gotten a better deal.
New problem: this weekend, we were each supposed to go and work on our own personal projects with no guidance until we come in on Monday with something to show, and I have to say that the most important lesson that I learned from this was make sure you have a conducive working environment. It can be hard to program when you’re surrounded by people talking and drinking and watching movies, but I still got a good start on a little project of mine. It’s a very simple app that will incorporate Core Graphics drawing, Parse-backed database, and Core Location geo-coordinates to help you see trends in your mood by location.
Fortunately we will have time to work on these projects in class today, because I naughtily spent the last hours of last night working on this beautiful force-based graph-drawing with my brilliant friend instead of building out the project. But I can’t say I feel too badly about it because I learned a lot about drawing with html canvas, and how similar it is to drawing with Core Graphics. My new ambition is to port this drawing to Objective C when I have a little time to. Anyway, today we will be learning about properly using blocks in Objective C, which are a lot like ‘anonymous’ functions except that they are also objects, so the way that they get called is a little bit odd. More on that later.