Tuesday, July 13, 2010

Animation in iOS 4.0

Well, I just got schooled on Core Animation. Apparently, iOS 4.0 changed everything, and now they want you to use blocks. Matz would be so happy, although it's a C thing (like so much of Ruby). Anyway, here's how I'm using blocks until told better (I could, at least, invert the logic so the BOOL is called "animate"):

- (void) makePhrases:(BOOL)inAnimation {
if (!inAnimation) {
[UIView animateWithDuration:3
animations:^{ [self makePhrases:YES]; }
completion:^(BOOL finished){ [self zoomIn:NO]; }];
CGSize spaceSize = [@" " sizeWithFont:tView.font];
float leftMargin = 8;
float topMargin = 8;

I'm using this inAnimation parameter everywhere, until I can figure out why it's a bad idea. Blocks! Small world, eh?

No comments: