Get your goggles on as we start diving into the code with C4.
From here on out we’re going to code, a lot. So, to get ready for that we want to have a solid plan to make life easier. The plan is simple: build a single view controller or object for each of the major components of the application. The next 5 chapters will focus each on one of the following:
- Infinite Scrollviews
- Astrological Signs
- Parallax Background
- Info Panel
To get infinite scrolling we’ll need to build a custom subclass of a UIScrollView which will continuously loop its content rather than bouncing at either end. We’ll apply some logic to the scrollview’s update method, and then we’ll test it out in a simple project. Later, we’ll use our new objects to build up the parallax background.
Throughout our app we’re going to be using, and reusing, icons and star orientations for each of the major astrological signs. Instead of hard coding the positions into, say, the background object or the menu, we’re going to build a singleton object that simply provides us with the shapes and orientations we need. We’ll set up some simple logic that gives us the opportunity to natural language to retrieve the data we need, making our code more readable throughout the rest of the app.
Space is vast, so we’ll build a component that creates a lot of depth for our app. Stacking 8 parallax layers and creating a variety of different kinds of images, randomization and subtle animations will give the app’s navigation a really nice feel.
The heart of the app is a killer radial menu that has a bunch of embedded animations for revealing and hiding its content. We’ll walk through building out the initial and final states, then we’ll set up the animations to move between the two states. Afterwards, we’ll modify a longpress gesture to open the menu choose one of its options.
Finally, we’ll add a little info panel that pops up from the menu to show some information about C4 and where to find this tutorial. This panel is going to be fairly straightforward, but it will give us an opportunity to work with push controllers, popups and external links.