Closed tconkling closed 12 years ago
Thanks, that's great! I added that method to Starling recently, so I had to port it to Sparrow, anyway. I'll move the sample to the class documentation on the top, but other than that, the code looks perfect! =)
Thanks again! I just added this to the core.
I had to remove the sortOptions though, to stay compatible with iOS 3; and I added a basic unit test for the functionality.
Ah, I didn't look at the compatibility for that function. Though it looks like -sortUsingComparator: is also not compatible with iOS 3...
(Using a stable-sort method is pretty important when sorting display objects. Non-stable sort methods result in objects of equal depth flickering as they swap positions in the display list.)
Ah, you're right ... I could have sworn I read "iOS 3" in the documentation -- my fault.
Hm ... well, it might work anyway; it doesn't need to compile with the 3.0 SDK, it only has to run on iOS 3.0 -- I'm using several block functions elsewhere already which are not available in the 3.0 SDK.
-- I'll test it, and will then use the stable-sort method, of course!
OK, it doesn't work in iOS 3. Bummer. But the heck with it -- people don't have to use it, do they? I just documented that it's only available in iOS 4, and throw a nice exception if someone calls it. ;-)
a method for sorting a DisplayObjectContainer's children (just trivially calls through to NSMutableArray.sortWithOptions:)