iDevGames Forums
iPhone CALayer constraint question - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: iPhone CALayer constraint question (/thread-1042.html)



iPhone CALayer constraint question - sritchie09 - Jul 8, 2009 05:32 PM

Hey all,

I'm currently designing a game using Core Animation layers--I have a gameboard sitting on one CALayer, with each game piece occupying a sub-CALayer.

When the program initializes, it places the sub-CALayers within its bounds--the problem is that the iPhone SDK doesn't provide support for a layoutManager, like Cocoa does.

I'm looking for a way to define constraints on the sub-CALayers with respect to a super-CALayer, without using a constraint manager. I basically don't want the sublayers to leave the bounds of the constraining layer. Does anyone know of a way to make this happen? Am I going to have to constantly compare coordinates, and just tell the sub-CALayer not to redraw if it moves outside the bounds?

Any ideas would be appreciated!

Thanks all,
~Sam