Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 8. Controls > Recipe: Adding Animated Elements to Buttons

Recipe: Adding Animated Elements to Buttons

You cannot add subviews to buttons, but you can certainly creatively layer art in front of or behind them. Use the standard UIView hierarchy to do this, making sure to disable user interaction for any view that might otherwise obscure your button (setUserInteractionEnabled:NO). Figure 8-2 shows what happens when you combine semitranslucent button art with an animated UIImageView behind it. The image view contents “leak” through to the viewer, enabling you to add live animation elements to the button.

Figure 8-2. Combine semitranslucent button art with animated UIImageViews to build eye-catching UI elements. In this recipe, the butterfly flaps “within” the button.



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial