Video: Implementing the iPad modal view

Now that we have a working groupView, itemView, and webView, it's time to implement our addView. The tactic is pretty simple. We're going to create the controller in the storyboard, connect it to the BWRSSAddViewController class, and set up the form elements. Let's start by making a working copy of BWRSS- splitview-03, and I'm just using this done version, you can use the version that you created in the last lesson if you're following along. I'm just going to rename it to BWRSS-splitview-04, and I'm going to open it in Xcode by double-clicking on this Xcode project file.

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.

Implementing the iPad modal view

Now that we have a working groupView, itemView, and webView, it's time to implement our addView.The tactic is pretty simple.We're going to create the controller in the storyboard, connect it to the BWRSSAddViewController class,and set up the form elements.Let's start by making a working copy of BWRSS- splitview-03, and I'm just using this done version, youcan use the version that you created in the last lesson if you're following along.I'm just going to rename it to BWRSS-splitview-04, and I'm going to open it in Xcode by double-clickingon this Xcode project file.

So now we're going to come up to the iPad storyboard, which is right up there, and I'mgoing to open up our Utilities View and scroll over here.You see we have the Items Table View Controller right there, and right under it I'm goingto go ahead and put our Add View Controller.So, the first thing I'm going to do is I'm going to add that button up here on our Feeds Table View Controller.So, come over here to Objects and Windows & Bars and grab a Bar button Item and justdrop it right there and call it an Add button so it gets that little Plus and Command+S to save.

Now, under our Items View Controller, I'm just going to scroll on over here, and I'mgoing to create a new controller.This is just a plain View Controller, so I'm going to drop it in right here and its sizeis going to be Form Sheet so that makes it manageable right there and drag it down over here.The Transition Style will say Cover Vertical. The Presentation will say Form Sheet.

And then we're going to set our controller to the BWRSSAddViewController, and I'm pressing Command+S to save.Now, I'll scroll down here so we can see a little bit more of it, and under Data ViewsI'm going to grab a Scroll View, and I'm going to drop that right here on this controller like that.Get it all nice and lined up, and over here, in the Attributes Inspector, let's scrolldown and give it a background of Scroll View Textured Background Color.

Now, the rest of this is going to be very much like what we did when we first createdthe addView controller for the iPhone. We can go ahead and populate this view.I'm going to start with a text label up here at the top, and I'll stretch that out to sidesusing these handy dandy guides that the Interface Builder gives us.I'm going to make it centered and make it the System Bold Font 17 size.

It's going to say Add RSS Feed, like that, and then I'm going to make it white.This background is actually dark. It doesn't look like it's dark, there it is.But you'll see when we run it in the Emulator that it actually is dark.Now we can grab another text label and put it right under this one, and we're going toleave this one left flush, and this is our Status Label, and it's going to say Enter a URL.

This one is going to be Size 12, and it's also going to be white.Now, we're going to grab a text field and put that right under that other text labeland bring that over to the sides and the text in there will say http://, and we're goingto scroll down here and set some properties here, Capitalization: None, Correction: No,Keyboard: URL, Appearance: Default, and Return Key: Done.So, now I'm going to grab a couple of buttons here, Round Rectangle Buttons, and I'm goingto drag them over here and align them up.

This little technique for doing this, and I'm going to grab them both and center them,and then the button on the left will be called Cancel, and the button on the right will be called Add.Now, we're going to connect our segue, and that will be a little bit challenging withthis being zoomed in like this.Let's see if we can do this with it zoomed out. I'm not sure that it will let me.I'm going to Ctrl-click on this button and drag it over here.

For Action Segue, I'm going to select Modal, and then I'm going to select our Segue likethis and the Identifier is SegueToAddView, like that.Presentation is just Default, Transition is also Default.Style is Modal, that's great.Now, we're going to come down here where we're going to connect our Controller.I need to zoom back in apparently.

So, I'm going to Ctrl-drag from here down to the Add View Controller, and we'll selectaddAction and the cancelAction, and do the same thing again and select cancelAction. That works.Now, when I select this controller, we should see those hooked up properly, they are, excellent.The URL text field should come over here and the Status Label will come over to this one here.

You can almost see that it's the second one. It's not the top one, it's the second one.And then finally, we want to drag this text field, we want to drag it down into ourViewController and where it says the Outlet Delegate, we need to connect that up.So, here we have our delegate outlet on the text field is set to the Add View Controller,and if we come down to the Add View Controller, we see that our delegate is that text field.

So now, this should all be hooked up properly, I'm going to press Command+S to Save, andwe're going to go ahead and run it in the iPad Simulator.I'm going to go ahead and put us in Landscape mode.We see there's our Plus button, I'll press that button, and there is our Add RSS Feed Controller.We can just type something in here, I'll put in wired.com and press the Add button, andthere is our Wired Feed, and you see that's all working.

I can come back here again, I can add another one say arstechnica.com, and I can press the Done button.All of this works exactly like it does now in the iPhone version, and you notice we didno coding at all for this.All we did was hook up this new View Controller to the exact same code.So, this is a lot less work because we're able to leverage most of the work we've alreadydone for the iPhone Form Factor.The Universal application model allows us to take advantage of two different platforms,two different sizes of screens, two different UIs, all with the same code base.

We now have a working storyboard interface that we can use for the Modal dialog box.With storyboard, this whole process becomes a whole lot easier.All we really need to do is set up the View Controller in the storyboard and connect itto our existing classes and then it just works.So, congratulations. You now have a fully-functional RSS Reader that runs in both the phone and tablet form factors.

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 "" :

Expand all | Collapse all

please wait ...

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.

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.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Already a member ?

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships.
Learn more

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.