Tabbed Views UITabBarController. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and.

Slides:



Advertisements
Similar presentations
How can Microsoft PowerPoint 2007 help you share information?
Advertisements

Step-by-Step: Add a Graphical Hyperlink USE the Special Events Final presentation that is still open from the previous exercise. 1.Go to slide 4, and click.
Detecting Collisions CSE 391 Fall 2012 Tony Scarlatos.
Creating and Editing a Web Page Using Inline Styles
OpenCMS and the MSASS Website. A Note on Terminology Locking a file for editing: No lockNOT locked You have write/edit access Someone else has write.
Microsoft Expression Web-Illustrated Unit C: Adding Text and Links.
Microsoft Word 2010 Lesson 1: Introduction to Word.
Word Processing First Steps
View Controllers (second part) Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create Presentation Open, Save, Run, Print, Close,Delete.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Using the File Manager WebCT 6. Understanding File Manager The File Manager is the area where all course files are stored. Whenever you link a file in.
Storyboards Managing multiple views. Overview Create a single view application Give the project a name and click “Use Storyboards” and “Use Automatic.
Review of last session The Weebly Dashboard The Weebly Dashboard Controls your account and your sites Controls your account and your sites From here you.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Sprite Animation CSE 391 Fall 2012 Tony Scarlatos.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
Github & Arduino How To: Post On Github How To: Download from Github How To: Upload Code Downloaded from Github to Arduino Tommy Sanchez EE400D Spring.
Xcode Presentation Tom Pletzke. Creating App from template Launch Xcode Select Tabbed Application.
© Ms. Masihi.  The Dreamweaver Welcome Screen first opens when you start Dreamweaver.  This screen gives you quick access to previously opened files,
Web Technologies Website Development Trade & Industrial Education
Xcode testing Using XCTest.
HTML, XHTML, and CSS Chapter 12 Creating and Using XML Documents.
Connecting to USF Network for Web Site SSH Secure Shell is the FTP program you will use to download your http files onto the USF server. To get the SSH.
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit F Creating Links and Navigation Bars.
Another Method to Open WebSpace as a Web Folder Alternative Method for Creating Web Folder in WebSpace, Slide 1Copyright © 2004, Jim Schwab, University.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
Website Development with Dreamweaver
iOS components in Swift
Dreamweaver CS4 Concepts and Techniques Chapter 4 Forms.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit D Formatting Text and Using Cascading Style Sheets.
HTML Concepts and Techniques Fourth Edition Project 7 Creating a Form on a Web Page.
Chapter 1 Creating a Dreamweaver Web Page and Local Site
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit H Collecting Data with HTML Forms.
Navigation in iPads splitViewController. Overview Create a Master-Detail application Switch Device Family to iPad Give the project a name and click “Use.
2008 Adobe Systems Incorporated. All Rights Reserved. Getting Started with Adobe Presenter Modified by C. Candace Chou.
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.
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit B Creating a Web Site.
Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.
View Controllers Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
Gestures UIGestureRecognizer.
Layers, Image Maps, and Navigation Bars
Nav Controllers UINavigationController. Overview Nav Controller basics Like a tabview controller, a navViewController manages views A navigationViewController.
Orientation Configuration adapting to orientation changes.
HTML Concepts and Techniques Fifth Edition Chapter 4 Creating Tables in a Web Site.
HTML Concepts and Techniques Fifth Edition Chapter 3 Creating Web Pages with Links, Images, and Formatted Text.
FIRST COURSE PowerPoint Tutorial 4 Integrating PowerPoint with Other Programs and Collaborating with Workgroups.
M. D. Slaughter1 Microsoft Office PowerPoint 2003 Tutorial Lai 687 Instructional Design M. D. Slaughter.
Lecture 10 Using Interface Builder to create Mac Applications.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
Creating and Editing a Web Page
Folio3 IPhone Training Session 2 Testing App on device Presenter: Imam Raza.
Creating and Editing a Web Page Using Inline Styles
Microsoft Office 2008 for Mac – Illustrated Unit D: Getting Started with Safari.
Web and Multimedia Development Copyright © Genetic Computer School 2007WM LESSON OVERVIEW  Use of Tables  Creating Tables  Try It – 1  Creating.
Creating Web Pages with Links, Images, and Embedded Style Sheets
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
WebViews UIWebView. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and xib) that manages.
© Ms. Masihi.  A Web page contains text and images that convey specific information to viewers.  To create a new web page, open Dreamweaver and select.
About SharePoint Server 2007 My Sites
EEC-492/693/793 iPhone Application Development
Chapter 1 Editing a Photo
CSC 581: Mobile App Development
Using Templates and Library Items
Apple Xcode with Swift Demo
Presentation transcript:

Tabbed Views UITabBarController

Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and xib) that manages which view is currently being shown to the user A tab controller switches views based on which tab button is selected. Other controllers Every view in the application has it’s own viewController and own xib file Taps in the content area go to the viewController Taps on the tab bar go to the UITabBarController.

The app We will create a Tab bar view using Xcode Choose File->new->project Click on Tabbed Application then click next Name your project, choose iPhone and Swift. Choose a place to save the project. Do not create a local git repository. Run the project. There should be an app with two buttons and two views.

What did you get? Look at the file navigator: These are the controllers for the first tab (it’s the root controller) and the second tab This contains the two icons used in the tab bar There is one storyboard with the two views.

Adding Tabs Need a viewController for each new tab. Choose File − >New − >File Choose Cocoa Touch Class and hit next Name the class ThirdViewController and make sure that it’s a subclass of UIViewController Do not check Also create XIB file The language should be Swift Choose the same folder that contains the rest of your code. Make sure the checkbox next to Targets is checked.

Adding Buttons This is the third view controller

Adding View Click on MainStoryboard and drag a view controller to the storyboard area. Make it look something like this. Change the name in the hierarchical view to “Third”

View Controller Click on the Third view controller in the Document Outline, then click on the attributes inspector. Change the Class to ThirdViewController.

Adding icon Create a png image that looks like the image below and call it “third.png”. Should be 30x30 pixels. Add it to the project.

Adding the tab bar button Connect the new view. go to the main storyboard Ctrl-drag from the “Tab Bar Controller view” to the new third view and let go. Choose “Relationship Segue”, “View Controllers” A third button will appear named “Item”. The third view controller will now be named “Item”. In the third view controller, click on the icon at the bottom. Then click on the attributes inspector. In the “Bar Item” section change the title to “Third” and then choose the new icon that you added from the pull- down menu next to “Image”.

Adding an external class What if we want to add an external class/view that we’ve developed somewhere else? We’ll start by creating a new project. Go to File − >new − >project and choose Single View Application Name the project myBrowser

Creating the view Click on the Main.Storyboard Add two buttons, a text field and a web view. make the placeholder text for the filed to be “Enter a URL” set the keyboard type to be “URL” set the return key to be “go” Arrange as in the next slide

Creating the View

Connecting the web view Click on the webview and open the connections inspector. Drag from the goBack circle to the “Back” button. Choose “touch up inside” from the pop-up dialog Drag from the goForward circle to the “Forward” button. Shoose “touch up inside” from the pop-up dialog

Connecting the web view Now create an IBOutlet for the textView and the webView. …and connect them to the text field and web view

Default page Add the bold code to viewDidLoad override func viewDidLoad() { super.viewDidLoad() let url = NSURL(string: " let request = NSURLRequest(URL: url!) myWebView.loadRequest(request) } Creates an instance of a NSURL that contains a URL Creates a URL request object that can be sent to a web view. Causes the webview to load the request

loading URL from text field In theViewController.swift file add an func loadAddressURL() { if let requestURL = NSURL(string: “ + urlField.text) { let request = NSURLRequest(URL: requestURL) myWebView.loadRequest(request) } urlField.resignFirstResponder() } Creates an instance of a NSURL that contains a URL Creates a URL request object that can be sent to a web view. Causes the webview to load the request Makes the keyboard disappear

loading URL from text field Go to Main.Storyboard click on the text field open the connections inspector connect Did End on Exit to the IBAction you created on the previous slide. Run

Connecting the web view Finally, go to the xib file and connect the did end on exit sent event to the method that you just created in the file’s owner.

Run Run the app; you now have a web browser! Note that when you enter a url you must enter the part also!

One last thing Go back to the nib and drag an activity indicator view onto your window. Control drag to create an IBOutlet for the activity indicator view. Add this line as the first line in the textFieldDoneEditing method: -(IBAction)textFieldDoneEditing:(id)sender{ [self.activityIndicator startAnimating];

Run Run the app again When you enter a URL the activity indicator should start rotating Notice that it does not stop. You have to make your view controller a delegate of the UIWebView and add the method – webViewDidFinishLoad: In this method you can stop the activity indicator from rotating: [self.activityIndicator stopAnimating];

Adding a tab redeux We know how to add a tab; how do we add a tab using a view controller from another project? First go to the finder, locate the three files you need (CMPViewController.h, CMPViewController.m, and CMPViewController.xib) and drag them into the Project Navigator in Xcode A dialog box will come up in Xcode. Make sure to check the box “copy into…” See next slide

Adding files Drag from finder to Project Navigator

Adding files You may have to ensure that the new files are part of the build. In the Project Navigator, click on the project name click on Targets click on Build Phases If you don’t see your new ViewController.m in the list, click on the + and add it. Only add the.m file

Adding files Or you can go to Files − >Add Files to “yourProject” Make sure the Add to targets box is checked.

Adding the tab button Now change the CMPAppDelegate by modifying the method below as you did before − (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Adding the tab button In the view controller that you just added, add this method − (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.title self.tabBarItem.image = [UIImage } return self; } I’m reusing an icon; you could create a new one if you like.