I recently had a situation where I needed to chain together two modal sheets off the same window. When the first sheet was presented, I obviously had the
NSWindow object for the window I wanted to attach to. Since my sheet had its own controller object, I could have simply stored this
NSWindow object and used it later for the next sheet.
However, I decided – largely as a matter of taste – that I’d rather figure out the sheet’s “parent” window programmatically in the
didEndSelector when the first sheet is dismissed. That way I don’t need to store the parent window anywhere in my controller.
In one of my previous posts I discussed my approach to starting development of a game. I’m still working on this, but I’ve come to the point where I may upgrade my drawing code a little bit.
In my initial development I was simply drawing into a UIView via its CGContext. Now I’m thinking about changing to drawing into CALayers. This gives me a few advantages. First, it lets me separate drawing a little bit more. I already have most of the drawing broken into separate methods in my view, but now I can set a layer for the score, and a layer for the objects (or even a layer per object). These aren’t too much of an advantage, but I think the biggest gain is that I can put a background image in a layer and then draw the rest of the items on top of it. I won’t need to redraw the background on the view for every frame of animation.
The second advantage is for some animations – I can just set them up and let them run. Take, for instance, an event like an explosion. I could create a few layers for some particles in the explosion, set them up on a path (maybe with some rotation), and then just let it run. I don’t have to add state tracking to animate these by hand with every frame.
I’ve only just started researching this, but I think this will work out nicely.
If you read my last post you know that I’m working on a game for iPhone. As part of my experimentation, I ran across a small issue I thought I’d share.
I’ve finally found some time to start working on an iPhone game that I’ve been thinking about writing. I won’t give out too many details of the game itself at this point, but I thought it might be interesting to some of you if I share a few notes about my approach so far. I’m fairly new to iPhone development and certainly to iPhone game development, so this will be a learning experience that I’ll share here.