Introduction to Objective-C and Xcode (Part 3) FA 175 Intro to Mobile App Development.

Slides:



Advertisements
Similar presentations
Java Script Session1 INTRODUCTION.
Advertisements

Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
The Web Warrior Guide to Web Design Technologies
Introduction to Objective-C and Xcode (Part 1) FA 175 Intro to Mobile App Development.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
CIS101 Introduction to Computing Week 12. Agenda Your questions Solutions to practice text Final HTML/JavaScript Project Copy and paste assignment JavaScript:
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Chapter Day 14. © 2007 Pearson Addison-Wesley. All rights reserved5-2 Agenda Day 14 Problem set 3 posted  10 problems from chapters 5 & 6  Due in 11.
Eyad Alshareef 1 Creating Custom Forms Part A. 2Eyad Alshareef Data Block and Custom Forms Data block form Data block form Based on data blocks that are.
ASP.NET Programming with C# and SQL Server First Edition
C++ for Engineers and Scientists Third Edition
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Storyboards Managing multiple views. Overview Create a single view application Give the project a name and click “Use Storyboards” and “Use Automatic.
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Introduction to Objective-C and Xcode (Part 2) FA 175 Intro to Mobile App Development.
Spreadsheet-Based Decision Support Systems Chapter 22:
Introduction to Object-Oriented Programming
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Using the Netbeans GUI Builder. The Netbeans IDE provides a utility called the GUI Builder that assists you with creating Windows applications. The Netbeans.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Introduction to Java and Object-Oriented Programming AJSS Computer Camp Department of Information Systems and Computer Science Ateneo de Manila University.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Objective C Basics. It’s C with Some Extras!  Cross Platform language  Mac  Linux/UNIX  Windows  Layer above C (Superset)  Adds Object-Oriented.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Classes CS 21a: Introduction to Computing I First Semester,
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 11 Conditional.
Introduction to Building Windows 8.1 & Windows Phone Applications.
Managing Multiple Views and Segues FA 172 Intro to Mobile App Development.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
+ An Intro To Xcode By Sarah Montroy. + What is Xcode?
Copyright © 2012 Pearson Education, Inc. Chapter 9 Classes and Multiform Projects.
Introduction to Objective-C and Xcode (Part 5) FA 175 Intro to Mobile App Development.
Sounds, Images, and Text FA 172 Intro to Mobile App Development.
Chapter 4 Introduction to Classes, Objects, Methods and strings
Nav Controllers UINavigationController. Overview Nav Controller basics Like a tabview controller, a navViewController manages views A navigationViewController.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Functions Overview Functions are sequence of statements with its own local variables supports modularity, reduces code duplication Data transfer between.
JavaScript, Fourth Edition
C++ / G4MICE Course Session 2 Basic C++ types. Control and Looping Functions in C Function/method signatures and scope.
OOP with Objective-C Categories, Protocols and Declared Properties.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Mobile Apps Programming Chin-Sung Lin Eleanor Roosevelt High School.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
More Objective-C Details FA 172 Intro to Mobile App Development.
Introduction to Objective-C Spring Goals An introduction to Objective-C As implemented by the Apple LLVM Compiler 4.0 (a.k.a. Clang) Only the basics…
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
Introduction to Objective-C and Xcode (Part 4) FA 175 Intro to Mobile App Development.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Outline Anatomy of a Class Encapsulation Anatomy of a Method Graphical Objects Graphical User Interfaces Buttons and Text Fields Copyright © 2012 Pearson.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Chapter 7 User-Defined Methods.
Working in the Forms Developer Environment
Using Procedures and Exception Handling
VISUAL BASIC.
User Defined Functions
Classes CS 21a: Introduction to Computing I
Defining Classes and Methods
CSC 581: Mobile App Development
Corresponds with Chapter 5
Presentation transcript:

Introduction to Objective-C and Xcode (Part 3) FA 175 Intro to Mobile App Development

Recap of last two sessions Intro to Objective-C and Xcode – Variables, types, computations, statements – Xcode: components, Interface Builder, connections Object-oriented programming – Classes and objects – Properties and methods – Objective-C classes:.h and.m files

Agenda More Objective-C details – Getters and setters – If statements Product inventory app

Properties and method calls Recall method call syntax – [ ] – [ : ] Retrieving property values is equivalent to a method call – myCar.gasLeft is equivalent to [myCar gasLeft] – When you declare a property, a getter method is automatically created – -(double) gasLeft { return _gasLeft; }

Properties and method calls Assigning a value to a property, e.g. – theProduct.stockLevel = 100; Is equivalent to – [theProduct setStockLevel:100]; A setter method is also automatically created (for readwrite properties) – -(void) setStockLevel:(int) quantity { _stockLevel = quantity; }

Statements we know so far Declarations – double salePrice; Assignments – discount = salePrice*0.10; Return statements – return computedValue; Function calls – world”); Method calls – [myCar driveDistance:94];

Conditional execution Sometimes, we want a statement executed only when a condition is met if-statement syntax: – if ( ) – if ( ) else

If-statement example In a withdraw method of a BankAccount class… if (self.balance >= amount) self.balance = self.balance - amount; Better yet, if (self.balance >= amount) self.balance = self.balance - amount; else balance”);

Blocks If multiple statements need to be conditionally executed, group as a block and enclose with { } if (self.balance >= amount) { self.balance = self.balance - amount; withdrawn”,amount); } else balance”); you.”); Note: The last statement is executed unconditionally

Conditions Conditions are a result of calculations that use – Relational operators: > = – Logical operators: && || ! Conditions return values of type BOOL – e.g., 10 > 5 returns a YES, 1 == 2 returns a NO The NSString function has a method for comparing strings – -(BOOL) isEqualToString:(NSString *) otherString;

Product inventory app Three projects ProductInvAppPrototype – Focus on user interface ProductTest – Focus on a product class ProductInvApp – Create the final app

ProductInvAppPrototype Create a single view project with three buttons Embed in a navigation controller – Select the view controller, then Navigator -> Embed In -> Navigation Controller Add one view controller to the storyboard with a label and an image view – Set label text to some product name (e.g., “Apple”) – Get an image file from the web representing the product (e.g., apple.jpeg), then drag onto “Supporting Files” section – Select the ImageView control, set the image file name

ProductInvAppPrototype Make two more copies of the view controller (that contains a label and an image) – Update these two copies so the three views represent different products (e.g., apple, orange and pomelo) Control-drag from each button to a view controller to create the corresponding segues – Select “push” Build and execute

ProductTest Create a single-view application with a single button – Add an action connection – Test code will be placed inside this method Create a Product class – Add three properties: name, imgFileName, and stockLevel (the first two are of type NSString* the third is an int) – Add method: -(void) increaseInvenory:(int) qty – Add method: -(void) decreaseInventory:(int) qty Test the Product class

ProductInventoryApp Follow instructions to be posted on the course website Summary – Two view controllers (controlled by a navigation controller), one for the main interface, the other for the product – Product class included in the project – Three products created by main view controller – Detail/product view controller has its display based on a product object