View Controllers (second part) Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.

Slides:



Advertisements
Similar presentations
Finding Library Materials Mrs. Engvall - Teacher Librarian John Campbell Elementary Using the Text OPAC.
Advertisements

Introduction to Macromedia Director 8.5 – Lingo
View-Based Application Development Lecture 1 1. Flows of Lecture 1 Before Lab Introduction to the Game to be developed in this workshop Comparison between.
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
Customizing the MOSS 2007 Search Results November 2007 Rafael Perez.
Getting Started with Cadence Compiled by Ryan Johnson April 24, 2002  Open Orcad Capture under Engineering Software  Under FILE, choose NEW, PROJECT.
CPIT 102 CPIT 102 CHAPTER 1 COLLABORATING on DOCUMENTS.
Create a calculator– 2nd iPhone programming exercise CSE 391 Fall 2012.
IOS and AddressBook CS4521. Address Book UI Framework Exploring Contacts.
About Links in Dreamweaver. Creating Links A link has 2 parts: –The URL (Uniform Resource Locator)= the name and path of the file you want to link –The.
Advanced Microsoft Word Hosted by Jared Hoffman Topics Keyboard Shortcuts Customizing Toolbars and Menus Auto Format & Auto Correct Tabs Inserting Pictures.
Getting Started with Layout Compiled by Ryan Johnson May 1, 2002  Open Orcad Capture under Engineering Software  Under FILE, choose NEW, PROJECT  The.
The Problem: iPhone UI Navigation I want to have a TableView that works INSIDE a TabView.
Anatomy of an iPhone Application Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
The Internet. Telnet Telnet means using your computer as a terminal. All commands you type are sent to the host computer you are connected to and executed.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Roentgen photo effect. This detailed, thoroughly explained lesson will show you how to create very attractive roentgen photo effect. You can use this.
Storyboards Managing multiple views. Overview Create a single view application Give the project a name and click “Use Storyboards” and “Use Automatic.
Introduction to Apps Development for the iPhone and the Android OS Art Gittleman Professor, Computer Science Calif State Univ Long Beach Feb 28, 2011.
Using Microsoft Outlook: Basics. Objectives Guided Tour of Outlook –Identification –Views Basics –Contacts –Folders –Web Access Q&A.
Outlook 2007 Tips, Tricks, and Tools. Overview Main Screen Navigation Pane View Pane Reading Pane To–Do Bar Create a New Message Contacts Create a Signature.
Access Tutorial 10 Automating Tasks with Macros
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Sprite Animation CSE 391 Fall 2012 Tony Scarlatos.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Xcode Presentation Tom Pletzke. Creating App from template Launch Xcode Select Tabbed Application.
Web Design Using HTML Codes. WHAT DO I NEED TO BEGIN DESIGNING A HOME PAGE? 1.YOU NEED A FOLDER (also called a DIRECTORY) You should set up a folder or.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
KJOlinski.com - RapidHMI INTRODUCING RapidHMI AND PLCExplorer.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
Introduction to the WebBoard Terry Dennis. The WebBoard - Our Connection The WebBoard URL is
| | Tel: | | Computer Training & Personal Development Outlook Express Complete.
Lehigh University Introduction to Flash MX Sharmeen Mecklai.
Selecting, Formatting, and Printing a finished Report…….
Creating a Project with C++ Builder
In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via.
4th Grade Book Publishing Project: Animal ABC Book
Active-HDL Interfaces Building VHPI Applications C Compilation Course 9.
Creating Buttons – Lesson 51 Creating Buttons Lesson 5.
Tabbed Views UITabBarController. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and.
IOS with Swift Hello world app.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
View Controllers Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Gestures UIGestureRecognizer.
Nav Controllers UINavigationController. Overview Nav Controller basics Like a tabview controller, a navViewController manages views A navigationViewController.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Gold – Crystal Reports Introductory Course Cortex User Group Meeting New Orleans – 2011.
CPS-Student Response System Dottie Betts ITRT June 2009.
Modal Dialogs. What is a Modal Dialog? A modal dialog is a separate window that remains in focus until it is closed by the user. During this time the.
1 UI Alert View iPhone/iPad, iOS Development Tutorial.
Lecture 10 Using Interface Builder to create Mac Applications.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
1 Reverse a String iPhone/iPad, iOS Development Tutorial.
When the program is first started a wizard will start to setup your Lemming App. Enter your company name and owner in the fields designated “Company Name”
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
Web and Multimedia Development Copyright © Genetic Computer School 2007WM LESSON OVERVIEW  Use of Tables  Creating Tables  Try It – 1  Creating.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
WebViews UIWebView. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and xib) that manages.
T_C_N_L_G_ E D I D I E O Y O H I E B J I R E A A W.
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
Creating User Defined Fields (NDF)
CSC 581: Mobile App Development
EEC-492/693/793 iPhone Application Development
Presentation transcript:

View Controllers (second part) Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson

Running Application From last lecture

Creating the New View Controller In Xcode, select the Classes group, Ctrl+click the group, and choose Add > New File from the pop- up menu. In the wizard that pops up, choose the “UIViewController subclass” item in the iPhone OS > Cocoa Touch Classes group. Don’t select the “With XIB for user interface” checkbox, because we will be creating our interface shortly. Click Next, and name the class MovieEditorViewController.

Adding outlets/actions to new UI UI with three text fields and one button Add the outlets and actions that we will need to interact properly with the UI to our header file The text fields will allow the user to edit the title, box-office gross, and summary, respectively, and the button will signal the user is done with the edits.

MovieEditorViewController.h Add a declaration at the top inside angle brackets for the UITextFieldDelegate protocol. That tells the compiler that this class intends to implement all required methods from that protocol. – Make sure to save the file so Interface Builder will know about the new outlets and actions we’ve added.

MovieEditorViewController.m Add the import of Movie.h Add statement for each of the properties that were declared in the MovieEditorViewController.h file. – Now we need to implement the viewWillAppear: method to place the values from the Movie object into the text fields.

viewWillAppear: method In MovieEditorViewController.m In the done method, we dismiss the current modal view controller with a call to the dismissModalViewControllerAnimated:

UITextFieldDelegate protocol We will make our view controller the delegate of all the text fields so we can capture the input via the UITextFieldDelegate protocol. We need to implement two methods of the UITextFieldDelegate protocol. – textFieldShouldReturn: – textFieldDidEndEditing:

textFieldShouldReturn: The textFieldShouldReturn: method is called by the text field when the user presses the Return button on the keyboard. This is the perfect spot for us to resign first responder status for the field (which in turn will cause the keyboard to animate out) by calling resignFirstResponder.

textFieldDidEndEditing: The textFieldDidEndEditing: method is called when the text field resigns its first responder status. This method is a great spot to capture the data that the user typed into the field. – We take the values from the fields and place those values into the movie object.

Building the new UI Now we need to add a new nib file to the project In Xcode, Ctrl+click the Resources group, choose Add > New File, click iPhone OS > User Interface, and then choose the View XIB item. Click Next, name the file MovieEditorViewController.xib, and then click Finish. Open MovieEditorViewController.xib in IB by double-clicking it.

Modify the new nib Modify the new nib so that it becomes the user interface for our MovieEditorViewController Change the class of the File’s Owner Select this object, and open the Identity inspector with D-4. Change the Class field to MovieEditorViewController.

UI and its connections Now that IB knows about our outlets and actions, we need to create the UI and make the connections. Open the view by double- clicking it. Create UI Make the connections

Connections Inspector This is what our Connections inspector should look like:

Configuring the Text Field Tap in a text region -> a keyboard Text field becomes the first responder We want the correct keyboard to show up, and we want it to be properly configured

Text Filed Attributes Here the text field is configured to capitalize words and take the defaults for correction, type, and appearance. The Return key is set to Done

MovieEditorViewController We have both view controllers and the user interface set up to display the movie as well as edit the movie. However, we have no way of getting to the second view where the user can edit the movie data.

Making the MovieEditorViewController 1.Add an outlet to MovieViewController for the instance of MovieEditorViewController we are going to create. 2.Update MovieViewController ’s edit method to modally display the MovieEditorViewController. 3.Create an instance of MovieEditorViewController in MovieViewController ’s nib file, and make the connection from the outlet.

Adding Outlet In MovieViewController.h add an outlet named editingViewController to the MovieEditorViewController Make sure to add the forward declaration:

Updating the edit method In MovieViewController.m Don’t forget to add the import statement to the implementation file for the MovieEditorViewController.h and statements for each property.

The Editing View Controller in IB Open the MovieViewController.xib file. We need to add a view controller to this nib file. From the Library, drag a view controller into the document window.

Still editing View Controller in IB We need to change the class of this view controller to MovieEditorViewController. Select the new view controller, open the Identity inspector, and change Class to MovieEditorViewController. Next we need to set the nib filename for this view controller, so open the Attributes inspector with D-1, and type MovieEditorViewController into the NIB Name field.

Connecting outlet to new view controller All that remains is to make the connection from the File’s Owner’s editingViewController outlet to the new view controller. Now hit Build and Go to see your work in the simulator.

The View Controller’s View When the view controller is asked for its view; if it’s not there, the view controller checks to see whether its nib file is set. If so, then the view controller loads that nib file, passing self in as the File’s Owner.

Our View Controller’s View And since we set the view property in our MovieEditorViewController.xib file, the view gets set. Here’s the basic picture of what happens once the view is requested but not found: