IPhone 4.0 OS, blocks

In my iOS adventures, I really dealt with blocks because they were necessary for UIViewAnimationin "Animation using blocks", which is the recommended way to animate UIView. Of course, this leads to the fact that the code does not support backward compatibility. I understand that this question has a subjective component, but at what point would using the iOS 4.0 code be a good idea? Or would differential code be a good idea and how would this be achieved in objective-c?

Now I am faced with a remake of my code for iOS 3.0, which is a painful task: should I just save the code of the “blocks” until the world moves forward?

+3
source share
1 answer

See Credible Blocks for port executable blocks of blocks up to 10.5 / iPhone OS 3. This may be easier than rewriting the code, although you will need to implement and add the appropriate animation methods to the UIView metaclass on 3.0 (hint:) class_addMethod().

I don’t think that we will cancel OS 3 support for another 6-9 months, depending on the adoption (especially considering that the iPad is still stuck on 3.2.1).

There is also no easy way to replicate setAnimationWillStartSelector:using the block-based animation API. I used it to synchronize sounds with the animation (you cannot just play the sound because the animation does not start until the layout / image is complete).

+5
source

Source: https://habr.com/ru/post/1759550/


All Articles