Get Updates By E-mail 

Article Written By:
Johann Dowa

iOS Library To Drastically Cleanup UIView Animation Sequence Code With Blocks (Open Source)

  •  
  •  
  •  
  •  
  •  

If you’ve ever animated a UIView – then you know how it works.

If you’ve been developing on the iOS platform awhile you may remember that early on UIView animations would take a ton of code.  You would start the sequence and write separate method calls to set the delegate and callbacks.

Support for blocks with UIView animations was introduced in iOS 4 which made for far less typing, but the syntax could still become very ugly and still requires quite a bit of typing..

This library provides a very elegant solution by using blocks so that you can drastically reduce the total amount of code.

Here’s an example showing how readable and concise the code is with the library:

[[AnimationSequence sequenceWithSteps:
[AnimationStep for:0.25 do:^{ self.imageView.alpha = 0.0; }], 
[AnimationStep for:0.25 do:^{ self.headline.alpha = 0.0; }], 
[AnimationStep for:0.25 do:^{ self.content.alpha = 0.0; }], 
[AnimationStep after:1.0 for:0.25 do:^{ self.headline.alpha = 1.0; }], 
[AnimationStep for:0.25 do:^{ self.content.alpha = 1.0; }], nil]  
run];

Quite an improvement!

You can find more on the creator’s website and download the library in the Github repository.

Via Alex Curylo


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments