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.
Now let's take a look at how to implement the iOS 6 pull to refresh feature. I'm going to create a working copy of our BWRSS-features-start, and I'm going to rename that as -02, and we'll open in Xcode by double clicking on the Xcode project file. We're going to be working in the ItemsTableViewController, and we notice up here at the top in our interface section, this is the private members or the instance variables for this class.
You'll notice there's a BOOL variable called canRefresh, and that gets set in -viewDidLoad. If I come down to -viewDidLoad, and we're going to come out to our Finder and load up this methods.txt file, and here is our new -viewDidLoad. I'm going to just copy that and come over here in to Xcode and I will paste that in place. So, you'll notice here I used the respondsToSelector method to check if our TableViewController response to the selector called refreshControl, and if it does, then I know that we can use Refresh so I can set this canRefresh equals true, or Yes in the case of Objective-C.
And I initialize our refreshControl with the UIRefreshControl and then I call addTarget on it to add the target, it is refreshInvoked:forState method, and it will be set for the control events, UIControlEventValueChanged. It looks a little bit complicated, and I guess it is, but this is just how you do it, and you'll pretty much always do it exactly this way. So, we're going to come back out here to our text editor, and I'm going to grab all of this support for reload gestures stuff here, and I'm going to come back into Xcode, and I'm going to paste it in right about here. Here is how this works.
Here's our refreshInvoked forState, and you'll remember that's the selector that we set as our target for the refreshControl event, right? So, when that gets called we reload our RSSFeed, and we send endRefreshing message to the RefreshControl, as simple as that. In order for that to happen, we have to be the first responder and so our class gets called with canBecomeFirstResponder to test whether or not we have that capability and so we use this canRefresh flag to return there.
When viewDidAppear, we're going to call becomeFirstResponder, and when view will disappear we resignFirstResponder. So that's all there is to it. When I save this and run it in the iPhone Simulator--I'm going to go ahead and add my test feed here so that's at ios.bw.org/testfeed, and I'll bring that up. There is five entries, and when I pull you see there is that little icon, and I pull it far enough, and it goes ahead it calls this rerefreshInvoked which reloads the feed and ends the refreshing, and there it is again.
So, we've now successfully added the pull to refresh feature to our app. This was easy for a number of reasons. First of all, Cocoa Touch Framework is really very well written and easy to code to then reloading the RSS Feed was also easy because our code is well-organized. If you do a good job of keeping your code clear and concise, then changing and modifying your code will always be a lot easier.
Find answers to the most frequently asked questions about iOS SDK and SQLite: Building Data-Driven Apps .
Here are the FAQs that matched your search "" :
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.
"Used type va_list (aka_builtin_va_list) where arithmetic or pointer type is required"
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.