Lec 5 Obj-C part 2 CS 3800 Introduction to IOS programming Lecture 5 Summer 2011.

Slides:



Advertisements
Similar presentations
Objective-C Lecture 2 Memory management Memory management in OC is semi- automatic: The programmer must allocate memory for objects either a) explicitly.
Advertisements

Lecture 3 - Writing Initializers A correct initializer must comply with the following: The initializer name should begin with init The initializer returns.
Black Jack in Objective-C
suppose you had Bumblebee, Jet, and Bird classes. All three, although unrelated, implement the flying behavior, and so you could say they are each a Flyer.
Review of Inheritance. 2 Several Levels of Inheritance Base Class B Derived class D Derived class D1.
Based on examples in "Programming in Objective-C," Copyright © 2004 by Sams Publishing O BJECTIVE -C Q UICK & D IRTY.
CS 3800 Su 11 Beg. IOS Dev L4 Obj C part 1 CS 3800 Introduction to IOS programming Summer 2011 G. Zimmerman.
Anatomy of an iPhone Application Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
IPhone Development Crash Course By Dylan Harris
IPhone Development JaxCodeCamp Who am I David Fekke.NET Developer, ColdFusion Work at LPS Presenter JaxDug, JaxJug, JSUG & JaxFusion Mac User 1986.
IPhone 101. Outline Objective-C Random bits of the API Using the simulator Debugging with Xcode.
COMP 110 Introduction to Programming Mr. Joshua Stough October 24, 2007.
Intro to Objective-C Syntax: What’s most confusing about Objective-C? Most class names start with NS: NSString, NSObject Parameter lists are not comma.
1 Objective-C Foundation Lecture Flow of Lecture 2  Objective-C Basics  Introduction to Objective-C  Intrinsic Variables and Image-Specific.
Objective-C Quinton Palet. Introduction  Objective-C was developed to bring large scale software development the power of the object-oriented approach.
Objective-C for C# and Java Developers JaxCodeCamp 2012.
Memory Management and Automatic Reference Counting/ Copying Objects Archiving Copyright © 2012 by Yong-Gu Lee
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.
More on Classes Inheritance Copyright © 2012 by Yong-Gu Lee
Object Oriented Programming
The Rest of the Story.  Constructors  Compiler-generated  The Initializer List  Copy Constructors  Single-arg (conversion ctors)  The Assignment.
Toward iOS programming. Overview  Objective-C is an object oriented language.  follows ANSI C style coding with methods from Smalltalk  Flexible almost.
Objective C Basics. It’s C with Some Extras!  Cross Platform language  Mac  Linux/UNIX  Windows  Layer above C (Superset)  Adds Object-Oriented.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
OS X Development Tom Schroeder. Table of Contents Who cares? HistoryObjective-CCocoaEnvironmentDesign.
Objective-C First Part adapted from a presentation by Kevin Layer.
5-Aug-2002cse Arrays © 2002 University of Washington1 Arrays CSE 142, Summer 2002 Computer Programming 1
Objective-C OOP Spring OOP Conceptually the same as C++, Java, and all other object oriented languages The syntax, however… …is, well, different.
C# D1 CSC 298 Elements of C# code (part 2). C# D2 Writing a class (or a struct)  Similarly to Java or C++  Fields: to hold the class data  Methods:
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
Lec 12 Pickers CS 3800 Introduction to IOS programming Lecture 16 Summer 2011.
Objective C. Основан на C Объектно-ориентированный Использует сообщения Динамический Протоколы Интроспекция.
Passing data between storyboard views Singleton pattern.
Objective-C Memory management Memory management is semi-automatic: The programmer must allocate memory for objects either a) explicitly (alloc) or b) indirectly.
Introduction to Objective-C and Xcode (Part 5) FA 175 Intro to Mobile App Development.
Course Summary Xcode & iPhone Simulator
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
OOP with Objective-C Categories, Protocols and Declared Properties.
Objects and Variables Local variables – Confined to single context: allocated on stack – Primitive types such as int or object references – Must be initialized.
Persistence CS 344 Mobile App Development Robert Muller.
More Objective-C Details FA 172 Intro to Mobile App Development.
Objective-C 기초 2 DongJoo Kim. Instagram Initial Release Users - 10 Million ( in 355days) Funding - 약 80 억원 기업가치 억원 ( 추정 )
The iOS Platform and SDK. iOS iPhoneiPad Mini iPad.
Peyman Dodangeh Sharif University of Technology Spring 2014.
1 Reverse a String iPhone/iPad, iOS Development Tutorial.
OBJECTIVE C Kurt Ladendorf. General Knowledge  Super set of C  Smalltalk  Mainly used for iOS and other Apple development.
Learning & Development Mobile apps for iPhone & iPad.
Introduction to Objective-C and Xcode (Part 4) FA 175 Intro to Mobile App Development.
1 11/30/05CS150 Introduction to Computer Science 1 Structs.
MORE on classes in …... OOP terminology in Objective-C Class: defines the grouping of data and code type of entity Object or Instance: a specific instantiation.
Inheritance, Abstraction, Encapsulation, Polymorphism Telerik Software Academy Mobile apps for iPhone & iPad.
Objective-C: Intro Michelle Alexander COMS E6998 2/4/2013.
4.1 Operating Systems Lecture 9 Fork and Exec Read Ch
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
Lec 9 MultiViews CS 3800 Introduction to IOS programming Lecture 9 Summer 2011.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 7: Introduction to Object- Oriented Programming in Python – Exercises Xiang Lian The University of.
Lec 12 Pickers CS 3800 Introduction to IOS programming Lecture 12 Summer 2011.
Course Summary Xcode & iPhone Simulator
Lesson 10: Dictionaries Topic: Introduction to Programming, Zybook Ch 9, P4E Ch 9. Slides on website.
Andy Wang Object Oriented Programming in C++ COP 3330
CS-104 Final Exam Review Victor Norman.
Creating Your OwnClasses
The Complete Guide For Programming Language Part 1
CS 302 Week 11 Jim Williams, PhD.
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
CS212: Object Oriented Analysis and Design
Return by Reference CSCE 121 J. Michael Moore.
Lecture 16 - Interfaces Professor Adams.
Presentation transcript:

Lec 5 Obj-C part 2 CS 3800 Introduction to IOS programming Lecture 5 Summer 2011

Lec 5 Obj-C part 2 Announcements Read ch5 for Wednesday.

Lec 5 Obj-C part 2 Topics Quiz 3 Review Getters/Setters Property/synthesize Dot Notation Memory Management –Retain, release, dealloc, autorelease NS data types –NSString, NSArray

CS 3800 Su 11 Beg. IOS Dev Objective-C alloc init ivars and functions Multiple parameters Property, Synthesize L4 Obj C part 1 Memory management Protocols Categories Inheritance

CS 3800 Su 11 Beg. IOS Dev Objective-C Classes NSObject NSArray NSString NSSet NSDictionary NSDate Mutable & Immutable L4 Obj C part 1

Lec 5 Obj-C part 2 NSString (immutable) child of NSObject.. means? creating –[ [ NSString alloc] init….] (many variations) Example: –convenience functions – [NSString conFuncName] –(many variations) Example:

Lec 5 Obj-C part 2 NSString - function survey length isEqualToString charAtIndex hash Conversion: –integerValue –doubleValue many more IMMUTABLE!?

Lec 5 Obj-C part 2 The point of the next 8 slides Understand the impact of the property attribute choices Use setters/getters inside the class –They should do 90% of memory management for you Build and Analyze tool

Lec 5 Obj-C part 2 Property, synthesize redux Employee Class contains objects! Open starter project.

Lec 5 Obj-C part 2 Property, synthesize redux Property options; assign simple assignment (default) retain retain the new version, release old copy creates a copy

Lec 5 Obj-C part 2 Build and analyze

Lec 5 Obj-C part 2 Under the hood of the setter #1 Assign: attribute self.name = aNewName; -(void) setName:(NSString*)aNewName { name = aNewName; } Don’t: self.name = ….

Lec 5 Obj-C part 2 Under the hood of the setter #2 retain: self.name = aNewName; -(void) setName:(NSString*)aNewName { if ( name == aNewName ) { [name release]; [ aNewName retain]; name = aNewName; }

Lec 5 Obj-C part 2 Property, synthesize redux Property options; readwrite (default) readonly (no setter is created)

Lec 5 Obj-C part 2 Property, synthesize redux Property options; nonatomic atomic ( default, but does not exist)

Lec 5 Obj-C part 2 Property, synthesize redux getter= Custom getters/setters

Lec 5 Obj-C part 2 Property, synthesize redux Do: Use setters/getters within a class Instead of direct iVars Example: initializer

Lec 5 Obj-C part 2 NSArray Order collection Immutable (after creation) + (id)arrayWithObjects:(id) firstObject, …., nil; -(int) count; -(id) objectAtIndex:(int) index; -(NSArray*) sortedArrayUsingSelector:(SEL)aSelector; -Application: Creating a UIPickerView