We saw a series of view animations written as deeply nested blocks
here;
search for the word “Nested”.
The following app unnests the blocks in a very civilized way.
You can see 12 of them all in a row in the
blocksFrom:
method of class
View
.
I would have preferred to create an array of blocks in the
initWithFrame:
method of class
View
,
and to execute these block in
drawRect:
or in a method called from
drawRect:
.
But the app crashed when the blocks mentioned
animatee
or any other instance variable of class
View
.
As far as I can tell now,
a block that mentions an instance variable must be created
in the method in which the block is called.
In fact, it must be created in the call to the method
in which the block is called.
The data type
AnimationBlock
is a
reference
to a block.
main.m
NestAppDelegate
View