1 UI Alert View iPhone/iPad, iOS Development Tutorial.

Slides:



Advertisements
Similar presentations
1 Application Software Course Simulink By: Mahdi Akbari 2010.
Advertisements

Mike Scott University of Texas at Austin
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.
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.
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.
Introduction to Objective-C and Xcode (Part 1) FA 175 Intro to Mobile App Development.
Qualtrics Survey Kenyon A Beginner’s Guide.
UIAlertView, UIActionSheet, and Facebook Connection Lecture 4 1.
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
View Controllers (second part) Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Storyboards Managing multiple views. Overview Create a single view application Give the project a name and click “Use Storyboards” and “Use Automatic.
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
Xcode Presentation Tom Pletzke. Creating App from template Launch Xcode Select Tabbed Application.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Xcode testing Using XCTest.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Introduction to Matlab & Data Analysis
iOS components in Swift
App Inventor MIT App Inventor.
Macromedia Dreamweaver 4.0 INTERFACE This presentation will run automatically.
Creating a Project with C++ Builder
1 Designing with a UIToolBar iPhone/iPad, iOS Development Tutorial.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
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.
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.
ASSIGNMENT OBJECTIVES TO PRACTICE OR USE THE FOLLOWING: 1.CONTROLS: - buttons, labels, picture boxes, groupboxes, and a form 2. EVENTS: - Click, MouseDown,
C# GUI - Basics. Objectives.NET supports two types: WinForms, traditional, desktop GUI apps. WebForms – newer, for Web apps. Visual Studio.NET supports.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Game Maker – Getting Started What is Game Maker?.
Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1.
Orientation Configuration adapting to orientation changes.
Splatter! ALPHA Presentation By: David Kikuta March 29, 2011.
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
First Step: Open a Microsoft Word document and save it by the name of your choice.
Table Views UITableView.
Lecture 10 Using Interface Builder to create Mac Applications.
The iOS Platform and SDK. iOS iPhoneiPad Mini iPad.
1 Reverse a String iPhone/iPad, iOS Development Tutorial.
Simple Clicker App WPF App using C#. App Requirement Need a ‘counter’ display, which starts at 0 Need a ‘clicker’ button ! Pressing the clicker every.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
JavaScript JavaScript is a programming language that web browsers understand. You can use it to make your web pages interactive by: Responding to user.
Introducing Scratch Learning resources for the implementation of the scenario
VAB™ for INFINITY Tutorial
Scratch for Interactivity
iOS - First Application Anatomy
GUI Programming using Windows Form
Designing with Introspection
Cataloging introductory flow
MFC Dialog Application
Multi-form applications and dialogs
EEC-492/693/793 iPhone Application Development
CSC 581: Mobile App Development
Android Topics UI Thread and Limited processing resources
Fundamentals of Programming I Windows, Labels, and Command Buttons
CSC 581: Mobile App Development
6. WinForms 2003 C# GUI - Basics.
Tonga Institute of Higher Education
EEC-492/693/793 iPhone Application Development
Creating a Simple Game in Scratch
CSC 581: Mobile App Development
Presentation transcript:

1 UI Alert View iPhone/iPad, iOS Development Tutorial

2 What is the UIAlertView? The UIAlertView class allows us to present a simple interface to alert the user that something has happened. It also allows us to respond in different ways, depending on which button in the alert view is touched. If we want more than the default cancel button on an alert, we must adopt the UIAlertViewDelegate protocol.

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.

4 In the.xib or Storyboard Add a button to the user interface that will bring up the alert view when pressed. Open the library and drag a UIButton to the view. Change the title of the button to “Change Color…” and (if desired) change the view’s background color as well. When you are done, the interface should look something like this:

5 Completed View

6 Click on “Editor” (tuxedo icon) Right mouse click and select “TouchDown” action. CONTROL + Drag the action to: ViewController.h Label the button “btnTouch” The code looks like this: - (IBAction)btnTouched:(UIButton *)sender;

7 ViewController.m Open ViewController.m and add the implementation of the btnTouched method: - (IBAction)btnTouched:(UIButton *)sender { UIAlertView *colorAlert = [[UIAlertView alloc] Color…" a Color" delegate:self nil]; [colorAlert show]; }

8 ViewController.m The title will appear at the top of the alert view, with the message just below it. Next the buttons will be displayed, with the three “otherButtonTitles” buttons displayed first, followed by the “cancelButtonTitle.” The delegate parameter defines the object that will handle the button touches, in this case, “self,” meaning ViewController.

9 Wire this method up to the Change Color… button in interface builder

10 Test the App If we run the application now, we’ll see the alert view when we click the button, but nothing will happen after clicking an alert button aside from the alert being dismissed. In order to handle touches on other alert buttons, we must implement one of the delegate methods of UIAlertViewDelegate: (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex. The first parameter of this method will be the alertView on which a button is touched, and the second will be the index of the touched button.

11 Modify - ViewController.m - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 1: //red self.view.backgroundColor = [UIColor redColor]; break; case 2: //yellow self.view.backgroundColor = [UIColor yellowColor]; break; case 3: //blue self.view.backgroundColor = [UIColor blueColor]; break; default: break; } }

12 Button Behavior The buttonIndex will be 0 if the cancel button is pressed, and incremental values starting at 1 for the otherButtonTitles array. In this case, we’re just changing the color of the ViewController’s view.

13 Program Output

14 Summary The UIAlertView is a “modal” view (meaning that it blocks touch events from bubbling up to it’s parent view), It doesn’t hang the UIThread, which makes it a very good control for simple choices.