1 Designing with a UIToolBar iPhone/iPad, iOS Development Tutorial.

Slides:



Advertisements
Similar presentations
Computer Vocabulary Words to know and remember for the semester.
Advertisements

Table Views UITableView. Overview Table view basics Tables display lists of data Each item in a tables list is a row Tables can have an unlimited number.
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.
Learning the Basics – Lesson 1
Detecting Collisions CSE 391 Fall 2012 Tony Scarlatos.
Project 8 Creating Style Sheets.
Let’s Get Started! Click on the Icon for the Buhl Digital Signage on your desk top. PREVIEW, CREATE AND SCHEDULE A SLIDE USING THE TEMPLATE WIZARD.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
How to create transparent background text boxes in MS Word
Interactive Boardmaker Basics By: Vanessa Wilkinson (nee Bushbacher) & Robyn Jung.
The Accelerometer CSE 391 Fall 2011 Tony Scarlatos.
The Problem: iPhone UI Navigation I want to have a TableView that works INSIDE a TabView.
View Controllers (second part) Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
PowerPoint Tutorial 1: Creating a Presentation
Storyboards Managing multiple views. Overview Create a single view application Give the project a name and click “Use Storyboards” and “Use Automatic.
 Experiment with the Design features to get the look you want for your presentation.  Most design templates will keep the design the same on all your.
IOS WorkShoP Xcode 4 iOS 5 : “A Primer”. Objective-C iOS applications are written in Objective-C language using the Cocoa Touch library Objective-C is.
05/09/ Introducing Visual Basic Sequence Programming.
Power Point EDU 271 Microsoft PowerPoint is a powerful tool to create professional looking presentations and slide shows. PowerPoint allows you to construct.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Xcode Presentation Tom Pletzke. Creating App from template Launch Xcode Select Tabbed Application.
Web Technologies Website Development Trade & Industrial Education
Xcode testing Using XCTest.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
1 1 iOS - iPhone/iPad Application Development Workshop Part 1.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
IE 411/511: Visual Programming for Industrial Applications
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit D Formatting Text and Using Cascading Style Sheets.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
Tabbed Views UITabBarController. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and.
Navigation in iPads splitViewController. Overview Create a Master-Detail application Switch Device Family to iPad Give the project a name and click “Use.
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.
Power Point Presentations “A how to primer”. Start with a “blank presentation” Instructions 1. Launch (or open) power point. 2. Close the office assistant,
Taskbar. START TASKBAR Programs Start Menu has the seven basics commands: Programs, Documents, Settings, Find, Help, Run, and Shut down.
Lesson 10 Using AutoShapes, WordArt, and Comments Lesson 10 Using AutoShapes, WordArt, and Comments.
Course Summary Xcode & iPhone Simulator
Nav Controllers UINavigationController. Overview Nav Controller basics Like a tabview controller, a navViewController manages views A navigationViewController.
Welcome to PowerPoint for Beginners In-Tech Training Elementary School Teachers Day 2 January 13 and 14, 2003.
Jeremiah McNichols Partnership for Environmental Education and Rural Health PowerPoint Toolbar Creator Instructions and Foundation.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Click your mouse for next slide Adding Text Click in any text box Type in your text OR.
The Controller in MVC of iOS CS4521. The controller in the MVC  Controller  Knows about model and view objects  The brains of the operation  Manages.
1 UI Alert View iPhone/iPad, iOS Development Tutorial.
The iOS Platform and SDK. iOS iPhoneiPad Mini iPad.
1 Reverse a String iPhone/iPad, iOS Development Tutorial.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
 2007 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2005 IDE.
Lec 9 MultiViews CS 3800 Introduction to IOS programming Lecture 9 Summer 2011.
이미지 뷰의 애니메이션 이미지 뷰는 자체적으로 애니메이션 기능을 제공하고 있습니다.
WebViews UIWebView. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and xib) that manages.
IOS Applications Michelle Alexander COMS E6998 2/4/2013.
AKA: How to make a STELLAR presentation!!
iOS - First Application Anatomy
Learning the Basics – Lesson 1
Designing with Introspection
View-Controller Family
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
The Microsoft Office suite provides themes to ensure consistent formatting both within and across documents and thus helps you create documents with a.
CSC 581: Mobile App Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
Presentation transcript:

1 Designing with a UIToolBar iPhone/iPad, iOS Development Tutorial

2 UINavigation Controller The UINavigationController maintains a UIToolBar for each view controller in its stack. This toolbar is normally hidden, but we can place buttons on it and display it any time we want.

3 Open a new “Single View” app Start Xcode, choose “Create a new Xcode project,” select the Single View Application template, and click Next. Select “Use Auto Reference Counting” Don’t select the storyboard. Don’t really need it for this application. Select ‘iPhone’ as the app type

4 Add a new Class Select the Objective-C class template, click Next Name the class MainViewController. Make sure that the class is a subclass of UIViewController and also create a XIB file for the controller’s view as shown:

5 Create: MainViewController

6 Edit AppDelegate.h Now we’re going to set up a navigation controller having a MainViewController object as its root view controller. Select the AppDelegate.h file, and add the two properties for the UINavigationController and the MainViewController as shown on the next slide.

7 Add 2 properties + header #import (strong, nonatomic) UINavigationController (strong, nonatomic) MainViewController *rootViewController;

8 Edit: AppDelegate.m First synthesize our navController = rootViewController = _rootViewController;

9 Edit: AppDelegate.m Change the didFinishLaunchingWithOptions: method It’s the only method we will be making changes to. Leave the remaining methods in place.

10 didFinishLaunchingWithOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.rootViewController = [[MainViewController alloc] initWithNibName:nil bundle:nil]; self.rootViewController.title View"; self.navController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController]; [self.window addSubview:self.navController.view]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }NSDictionary

11 What are we doing? First, we allocate and initialize the rootViewController. The nib name of nil in this case directs the compiler to associate this controller with the XIB file that was created with it (MainViewController.xib). A bundle of nil directs the compiler to use this application’s bundle. After we initialize this controller, we set its title View.” This title will appear in the navigation bar for this view controller.

12 navController Object Next, we set up the navController object. We make rootViewController this object’s Root View Controller. Adding the navController’s view to the main window as a subview, we then make the main window key and visible, and we’re off and running.

13 MainViewController.xib

View” Since the view controller’s title property was set View” in the AppDelegate, that title will appear at the top of the interface when we run the app:

15 MainViewController.m Open the MainViewController.m file, and make these additions to initWithNibName : bundle.

16 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // set up the nav bar button: UIBarButtonItem *btnShow = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSea rch target:self self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:btnShow, nil]; // set up the tool bar buttons: UIBarButtonItem *btnRed = [[UIBarButtonItem alloc] style:UIBarButtonItemStyleDone target:self UIBarButtonItem *btnBlue = [[UIBarButtonItem alloc] style:UIBarButtonItemStyleDone target:self UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFl exibleSpace target:nil action:nil]; UIBarButtonItem *btnGreen = [[UIBarButtonItem alloc] style:UIBarButtonItemStyleDone target:self self.toolbarItems = [NSArray arrayWithObjects:btnRed, btnBlue, spacer, btnGreen, nil]; } return self; }NSStringNSBundleNSArray

17 What did we do? We add a UIBarButtonSystemItemSearch button to the navigationItem’s rightBarButtonItems array. This button will be placed at the right of the top navigation bar. Next, we set up three bar buttons (btnRed, btnBlue, and btnGreen) and a spacer. The three buttons each have a selector, these will be defined shortly. Each also is initialized with a title, and a style of UIBarButtonItemStyleDone, which will produce a button with a blue background and white bolded text.

18 What did we do? The function of the spacer is to add “flexible space” between btnBlue and btnGreen. Flexible space will act as a “spring” between the two buttons, pushing btnGreen all the way to the right of the tool bar. Since this space is invisible, it makes no sense to assign it an action method, so we have set both the target and action of this object to nil.

19 What did we do? Now that we have the buttons, we need to add them to the tool bar. Each view controller has it’s own toolBarItems property, which is an NSArray of UIBarButtonItem objects. We stuffed the toolBarButtons array with the three buttons and the spacer.

20 Add to: MainViewController.m The last step… Implement the four methods we set as actions in the buttons as shown in the code on the next slide.

21 - (void)toggleToolBar { BOOL barState = self.navigationController.toolbarHidden; [self.navigationController setToolbarHidden:!barState animated:YES]; } - (void)btnRedTouched { self.view.backgroundColor = [UIColor redColor]; } - (void)btnBlueTouched { self.view.backgroundColor = [UIColor cyanColor]; } - (void)btnGreenTouched { self.view.backgroundColor = [UIColor greenColor]; }

22 What did we do? toggleToolBar gets the hidden property of the tool bar, then sets that property to its negation. In other words, if the tool bar is hidden it will be shown, if it is shown it will be hidden. The three btn…Touched methods set the color of the view’s background to red, cyan, or green when they are touched.

23 Program Output