Build a Blog Reader iPhone App
The Blog Reader app will teach us one of the most common and important needs when creating an app: downloading data from the Internet and displaying it in a list. We will investigate the Model-View-Controller design pattern (MVC) that is essential for all iPhone apps, learn how to request data from the web, parse and use information in JSON format, and utilize the built-in UITableViewController to display a list of blog post titles and thumbnails. We'll also see how to display a webpage inside our app.
Watch the Trailer
5 badges • 19 videos
Exploring the Master-Detail Template
Xcode’s Master-Detail template makes it easy to create an app that displays a list view along with a detail view. We will look at all the code generated by the template and learn about table view controller, delegate and datasource.
Rebuilding from Scratch
Time to ditch the template code and recreate the master-detail app from scratch. Rebuilding allows us to learn the fundamental design pattern known as Model-View-Controller (MVC). In addition, we will learn about the view controller lifecycle and how to connect view elements on the storyboard to our code.
Getting Data from the Web
Learn how data can be requested from a web service, parsed and then stored. We will learn how to access data in the JSON format which involves downloading and parsing it. Once parsed, the data needs to be stored in a collection object such as a dictionary.
The advantage of object-oriented programming is the ability to model your data after real-world objects. Parsing the JSON data gave us a better understanding of its structure. We can now create a custom class to represent an individual blog post. The custom class will serve as a concrete representation of a blog post and will make our code manageable and readable.
Adapting Data for Display
The downloaded data needs to be neatly displayed in the table view. Each row will show the blog post title, author and thumbnail, which involves customizing the table view cell to accommodate all three elements.
Stage Coming Soon
Viewing a Webpage
Upon selecting a blog post from the list, the user is taken to a detail view where they can read the entire blog post. The blog post is simply a web page which can be displayed with the help of a special view known as a web view of the class UIWebView.