IPhone 101. Outline Objective-C Random bits of the API Using the simulator Debugging with Xcode.

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

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.
Create a calculator– 2nd iPhone programming exercise CSE 391 Fall 2012.
IOS and AddressBook CS4521. Address Book UI Framework Exploring Contacts.
Introduction to Objective-C and Xcode (Part 1) FA 175 Intro to Mobile App Development.
CS 3800 Su 11 Beg. IOS Dev L4 Obj C part 1 CS 3800 Introduction to IOS programming Summer 2011 G. Zimmerman.
The Problem: iPhone UI Navigation I want to have a TableView that works INSIDE a TabView.
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/iPad Programming Reuben Edwards. Contents iPhone & iPad Layout Objective-C UIKit Other APIs Alternative Tools.
IPhone Development JaxCodeCamp Who am I David Fekke.NET Developer, ColdFusion Work at LPS Presenter JaxDug, JaxJug, JSUG & JaxFusion Mac User 1986.
IStarted- And You Can Too! A Beginner’s Guide to iOS Programming.
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.
Sprite Animation CSE 391 Fall 2012 Tony Scarlatos.
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.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Objective C Basics. It’s C with Some Extras!  Cross Platform language  Mac  Linux/UNIX  Windows  Layer above C (Superset)  Adds Object-Oriented.
OS X Development Tom Schroeder. Table of Contents Who cares? HistoryObjective-CCocoaEnvironmentDesign.
Objective-C First Part adapted from a presentation by Kevin Layer.
1 Designing with a UIToolBar iPhone/iPad, iOS Development Tutorial.
Objective-C OOP Spring OOP Conceptually the same as C++, Java, and all other object oriented languages The syntax, however… …is, well, different.
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.
Embedded Software SKKU 14 1 Sungkyunkwan University Tizen v2.3 Application Profiling & Debugging.
Using Xcode A Beginner’s Tutorial Erin Green. This tutorial will walk you through Xcode, a software development tool for Apple’s iOS applications – We.
+ An Intro To Xcode By Sarah Montroy. + What is Xcode?
View Controllers Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
Objective-C Memory management Memory management is semi-automatic: The programmer must allocate memory for objects either a) explicitly (alloc) or b) indirectly.
Last Lecture objective C memory management rules Wrote our first iPhone app a quiz app xib and nib files and interface editor MVC pattern IBOutlet IBAction.
 Facebook Integration on iOS Phan Thanh Phat Huynh Thanh Van.
Course Summary Xcode & iPhone Simulator
User Interface Objects From Beginning iPhone 4 Development and The iPhone Developer’s Cookbook (Chapter 4)
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.
Mobile Apps Programming Chin-Sung Lin Eleanor Roosevelt High School.
1 UI Alert View iPhone/iPad, iOS Development Tutorial.
More Objective-C Details FA 172 Intro to Mobile App Development.
The iOS Platform and SDK. iOS iPhoneiPad Mini iPad.
1 Reverse a String iPhone/iPad, iOS Development Tutorial.
Lec 5 Obj-C part 2 CS 3800 Introduction to IOS programming Lecture 5 Summer 2011.
IOS Programming Medialogy, Semester 7, 2010 Aalborg University, Aalborg David Meredith
2/20/2016 EEC492/693/793 - iPhone Application Development 12/20/2016 EEC492/693/793 - iPhone Application Development 1 EEC-492/693/793 iPhone Application.
Introduction to Objective-C and Xcode (Part 4) FA 175 Intro to Mobile App Development.
Objective-C: Intro Michelle Alexander COMS E6998 2/4/2013.
이미지 뷰의 애니메이션 이미지 뷰는 자체적으로 애니메이션 기능을 제공하고 있습니다.
IOS Applications Michelle Alexander COMS E6998 2/4/2013.
Iphone Online Training AcuteSoft: India: , Land Line: +91 (0) USA: , UK : +44.
Course Summary Xcode & iPhone Simulator
IOS Design Patterns Sisoft Technologies Pvt Ltd
iOS UI Components Sisoft Technologies Pvt Ltd
iOS - First Application Anatomy
HW#9 IOS Clues CSCI571 Spring 2017
Designing with Introspection
UITableView API A table view is an instance of the UITableView class. Created given... an area on the screen, and A table style. Rows are created using.
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
Affordable iPhone Mobile Apps Development Services Company
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
CSC 581: Mobile App Development
CSC 581: Mobile App Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
Development with UIKit on Xamarin.ios
EEC-492/693/793 iPhone Application Development
Presentation transcript:

iPhone 101

Outline Objective-C Random bits of the API Using the simulator Debugging with Xcode

Objective-C Superset of 'C' with OO stuff added C++ classes → interface/implementation C++ methods → messages No static member variables Only need to declare public methods or those needed before the implementation Inheritance with Java-like multiple inheritance (using protocols)

Objective-C File extensions:.h,.m, and.mm Class StringParser : NSObject NSString* fContent; } - (id)init:(NSString *)content options:(int)options; +

Objective-C #import StringParser - (id)init:(NSString *)content options:(int)options { fContent = [content retain]; return self; } - (void)dealloc { [fContent release]; [super dealloc]; } + (int)SomeStaticMethod:(int)value {

More Objective-C Object allocation, destruction and reference counting using retain/release/autorelease Categories Properties Delegate objects

More Objective-C Most Objective-C methods return the object itself (as an 'id') so you can chain calls in a single statement. /* nested brackets */ bb = [[[UIBarButtonItem alloc] initWithCustomView:logo] autorelease]; NSArray *paths = SomeFunction(); NSString *downloadPath = [[[paths objectAtIndex:0] stringByAppendingPathComponent:kDownloadFolder] retain];

More Objective-C (categories) /* declaring categories NSString (NSString_URLEncode) - (NSString NSString (NSString_URLEncode) - (NSString *) encodeAsURL { /* do stuff using public methods of NSString */ /* using the category */ NSString *foo = SomeFunctionThatReturnsAString(); [request url:[foo encodeAsURL]];

More Objective-C (properties) /* in class definition NSObject *delegate; NSString *fName; /* in method area (after) NSObject * retain) name; /* implementation name = fName; /* accessing */ Foo *foo = [[foo alloc] init]; foo.delegate = self; foo.name

More Objective-C (delegates) /* protocol declaration RequestManagerDelegate - (void)onLoginComplete:(YYLoginStatus)status msg:(NSString /* class which has a delegate object */ NSObject *delegate; /* Calling a delegate method */ [delegate onLoginComplete:kNetworkError msg:nil]; /* class that implements the delegate methods SomeClass : /* delegate method implementation */ #pragma mark RequestManager delegate methods - (void)onLoginComplete:(YYLoginStatus)status msg:(NSString *)msg { }

Cocoa Touch API Data types: id, BOOL, NSInteger, NSUInteger, NSNumber, NSString, long long Collections: NSDictionary, NSArray, NSSet and their mutable friends NSTimer, NSThread*, NSURLConnection UIResponder for managing the responder chain and touch events Core Graphics, Core Animation, Core Audio, Core Location (obj) can be used by multi-threaded apps

Anatomy of an iPhone app App delegate: lifecycle (ex: applicationDidFinishLaunching, applicationWillTerminate) Navigation bar, tab bar, and view controllers Event driven using a “run loop” (provided for main thread) Register “selectors” to handle events: Implement delegate protocols to handle events from various UI/data objects

Anatomy of an iPhone app UI construction – code or Interface builder UIKit is the iPhone UI framework UIViewController for managing screens UI elements: UIView, UIImageView, UIButton, UIPickerView, UILabel, UITextView, UITableView, UIAlertView, etc. Some UIView useful methods:  addSubview and removeFromSuperview  beginAnimations:context: method and transform property for simple implicit animation

Anatomy of an iPhone app UINavigationBar / Item UIBarButtonItem UIImageView / UIImage UILabel UITextField UIButton UITabBarController UITabBarItem/badgeValue

Tab bar components

Navigation item components

UICatalog sample app

iPhone SDK miscellany retain/release/autorelease carefully! SDK class factory functions usually return autorelease'd objects (ex: [NSString stringWithFormat...]) A view-controller's loadView can get called multiple times if the view is released due to low memory Localizing strings using NSLocalizedString User-defined “OTHER_CFLAGS” for build flags

Workshop - A simple tab-bar based iPhone app 1.Enable code in applicationDidFinishLaunching to add one view controller 2.In FirstViewController, add a red box at 10,10 which is 100x100 using UIView::initWithFrame and CGRectMake() 3.Add a white label in that box at 10,10 with a 12pt system font 4.Add a second view controller and give it a yellow background 5.Add names and tab bar images (UITabBarSystemItem) to both view controllers 6.Inspect code for memory leaks. Did you remember to release after adding views to subviews? 7.In the second view controller, use a timer (NSTimer scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:) with 1 second interval to increment a counter (an instance of UILabel) somewhere in the middle of the screen. Use NSString::stringWithFormat to convert a number to a string printf-style. 8.Use Xcode to set breakpoints and inspect variables