Building the view controller
Video: Building the view controllerThe first step in building our Testbed is to create the view controller in interface builder. So let's create a project in Xcode and get started. Let's start up Xcode here and under the File menu I'm going to select New > Project. Under iOS and Application I'm going to select Single View Application and press Next. The Name of our project will be Testbed, and I leave the Organization Name alone. Company Identifier, example.com, you'll notice that's in reverse domain notation, and you'll just use your own domain name, or you'll make something up for it.
Viewers: in countries Watching now:
The iOS software development kit (SDK) includes the popular SQLite library, a lightweight yet powerful relational database engine that is easily embedded into an application. In this course, Bill Weinman teaches you how to build an RSS reader for iOS devices, integrating XML data and a streamlined interface. He explains how to use the SQLite database, display information in a table view, code view controllers, and create a preferences pane for your app. The resulting application is optimized for all iPhone and iPad displays.
- Prototyping the app
- Coding and working with a testbed
- Creating an Objective-C interface for SQLite
- Designing a database schema
- Creating the view controllers
- Reading and writing to the database
- Parsing the RSS feed with NSXMLParser
- Updating the item view with feed items
- Implementing the pull to refresh gesture for iOS 6
- Creating a universal application with multiple views
Building the view controller
The first step in building our Testbed is to create the view controller in interface builder. So let's create a project in Xcode and get started. Let's start up Xcode here and under the File menu I'm going to select New > Project. Under iOS and Application I'm going to select Single View Application and press Next. The Name of our project will be Testbed, and I leave the Organization Name alone. Company Identifier, example.com, you'll notice that's in reverse domain notation, and you'll just use your own domain name, or you'll make something up for it.
Our Class Prefix is Testbed, that's used for building the Class Names and Devices just the iPhone, and we're going to Use Storyboards, Use ARC, and we do not need Unit Tests for this, so I press Next. This is in our exercise files Chap01 and Create, and there is our Testbed application. So before we can create the view controller and interface builder we need to create an outlet in the code.
So I'm just going to go into the code here, and I'm going to close that on the right so we can see the code. I'm in the .m File because we're going to create the outlet as part of the private interface, that's because we don't need it exposed to the public, there is no property, and it's not in the header file, it's just going to be right here in the .m file. Under interface I am going to put in some brackets and create the outlet right here. IBOutlet UITextView, because this is going to be a text view, ViewController and an asterisk to make it a pointer because objects in Objective-C are Pointers, and I'm going to call it TextView like that and a semicolon and pressing Command+S on my Mac keyboard to save this, and we're done.
You notice it creates this little circle over here that we're going to use as an outlet, and we'll get to that in a moment. Now I'm going to up here to the Storyboard, and you'll notice--I'm just going to minimize this controller thing over to the left there because we have limited real estate here on this display for the purpose of the recording--you'll notice down here at the bottom it says Testbed View Controller. I'm going to bring the inspector back on the right and show the attributes Inspector. You notice there's nothing there yet because I haven't selected anything yet.
Under my objects here, so you want to make sure that your Objects tab is selected, under Objects I'm going to select Data Views, that's what we want. We want the TextView, which is right here, I'm going to grab a TextView, and I'm going to drag it on to my View Controller and just get it all lined up just right there. And now under my Inspector you'll notice that it's got text in it, so I'm just going to select all of that and delete it. I'm going to press Enter on my keyboard, and you see all that text goes away in the View.
I am going to uncheck Editable because we don't need this to be actually Editable. Now I'm going to bring up my Assistant editor, and you'll notice that it brings up the TestbedViewController.h. We actually want the .m file so I'm going to select the .m File here because there is outlet, and I just drag that over to the View Controller, and we're done. So the View Controller now, if I select my View Controller and go over here to the Inspector, you'll see that my TextView is in the Referencing Outlets, and that's exactly what we want.
So now we've created the View Controller and all that's left is to plug in the code to make it work. So I'll save this, and we'll plug in the code in the next movie.
Find answers to the most frequently asked questions about iOS SDK and SQLite: Building Data-Driven Apps (2013) .
Here are the FAQs that matched your search "" :
- Q: Why is the RSSDB library in the exercise files different than the one in the videos?
A: The RSSDB library had to be updated to work around a bug in the iOS 7 SDK.
There is a bug in the iOS 7 SDK that prevents the BWDB fast enumeration implementation from working on a device. The symptom is code that runs fine on the emulator, but not on a device. iOS devices use an ARM processor, while the emulator runs on your Mac's Intel processor. This points to the LLVM ARM code generator as the source of the bug. Because the bug appears to be in the LLVM compiler, it may be some time before it is fixed.
As a workaround we have changed the getFeedIDs and getItemIDs methods in the RSSDB library so they don't use Objective C fast enumeration.
Please note that this same bug also affects some of the BWDB testbed code in Chapter 2. The result is that it will run on the emulator but not on a device.
- Q: After upgrading to Xcode 5.1 I get an error that says:
"Used type va_list (aka_builtin_va_list) where arithmetic or pointer type is required"
- A: Please download the exercise files again to get the latest version of the BWDB library.
- Q: I'm using Xcode 6. Why am I getting error messages with the exercise files?
- A: A lot has changed in iOS since this course was released. The author is in the process of rewriting the code and updating the course for iOS 8. In the meantime he has prepared a version of the app that works in iOS 8 and Xcode 6. Download it here:http://ios.bw.org/
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.