Beginning iOS Animations - Part 9: Beginning View | Ray Wenderlich

Learn how to create simple View Controller transition animations.

This is a companion discussion topic for the original entry at

What does the following code do?

listView.viewWithTag(0)?.tag = 1000 //prevent confusion when looking up images

Hi @ian123,

This line is finding listView’s subview with a tag value of 0 (this is actually the horizontal scroll indicator, in this case), and changing that tag value, so that the herb image views can safely be assigned to tag values 0-4. You can see these tags being assigned in setupList(), and then used for lookup in the positionListItems() method. If you comment out the line you asked about, you’ll see that the herb image view that should be tagged with 0 (basil), is no longer sized or positioned properly within the scroll view.