Praktikum Entwicklung von Mediensystemen mit



Similar documents
INTRODUCTION TO IOS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 13 02/22/2011

Creating a Custom Class in Xcode

ios Development Tutorial Nikhil Yadav CSE 40816/60816: Pervasive Health 09/09/2011

Developing Applications for ios

Objective C and iphone App

MA-WA1920: Enterprise iphone and ipad Programming

Chapter 1. Introduction to ios Development. Objectives: Touch on the history of ios and the devices that support this operating system.

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

Praktikum Entwicklung von Mediensystemen mit ios

ios Application Development &

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Xcode Application note

How To Develop An App For Ios (Windows)

2. About iphone ios 5 Development Essentials. 5. Joining the Apple ios Developer Program

An Introduction to Modern Software Development Tools Creating A Simple GUI-Based Tool Appleʼs XCode Version 3.2.6

iphone Objective-C Exercises

ios App Development for Everyone

Send from your App Part 1

ios Dev Fest Research Network Operations Center Thursday, February 7, 13

Android v ios Mobile Operating Systems

MEAP Edition Manning Early Access Program Hello! ios Development version 14

Mobile Application Development ITP 342 (3 Units)

ios Dev Crib Sheet In the Shadow of C

ios App for Mobile Website! Documentation!

Your First ios Application

Mobile Application Development ITP 342 (3 Units)

M, N, O F, G, H. network request, 101 ParseFacebookUtilities SDK, 100 profile, 100 user_about_me, 101 -(void)updateindicator, 101

Introduction to Objective-C. Kevin Cathey

How To Use Ios 5

Mobile App Design and Development

Mobile Application Development

Mobile Application Development ITP 342 (3 Units)

Assignment I Walkthrough

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Praktikum Entwicklung von Mediensystemen mit ios

iphone SDK Enrolled students will be invited to developer program Login to Program Portal Request a Certificate Download and install the SDK

iphone ios 6 Development Essentials

Praktikum Entwicklung von Mediensystemen mit ios

TakeMySelfie ios App Documentation

CS 528 Mobile and Ubiquitous Computing Lecture 2: Android Introduction and Setup. Emmanuel Agu

COLLIN COLLEGE COURSE SYLLABUS

Mobile Phones Operating Systems

2. Create the User Interface: Open ViewController.xib or MainStoryBoard.storyboard by double clicking it.

Start Developing ios Apps Today

This documentation is made available before final release and is subject to change without notice and comes with no warranty express or implied.

Android App Development. Rameel Sethi

geniusport mobility training experts

Building Mobile Applications Creating ios applications with jquery Mobile, PhoneGap, and Drupal 7

Praktikum Entwicklung von Mediensystemen (Android)

View Controller Programming Guide for ios

Cookbook. Flash ios Apps. Christopher Caleb. 100 practical recipes for developing ios apps with Flash Professional and Adobe AIR PUBLISHING MUMBAI

Your First App Store Submission

Your First Windows Mobile Application. General

White Noise Help Guide for iphone, ipad, and Mac

Wiley Publishing, Inc.

City of Corpus Christi. Mobile GIS Viewer. For ipad

eggon SDK for ios 7 Integration Instructions

Development of Computer Graphics and Digital Image Processing on the iphone Luciano Fagundes

AC : OBJECTIVE-C VERSUS JAVA FOR SMART PHONE AP- PLICATIONS

Lecture 1 Introduction to Android

Workshop on Android and Applications Development

COMPARING APPLE S IOS WITH SAMSUNG S BADA MOBILE SOFTWARE DEVELOPMENT PLATFORMS

Cocoa Fundamentals Guide. (Retired Document)

Assignment 2: Matchismo 2

Android Architecture. Alexandra Harrison & Jake Saxton

Send and receive encrypted s

01. Introduction of Android

Introduction to Programming with Xojo

geniusport mobility training experts

Cross-platform mobile development with Visual C

Introduction to iphone Development

Hands- On Training for Android and ios Software Developers

Chapter 1. Xcode Projects

How to Make iphone Apps

Lecture 3 Mobile App Development (Android, ios, BlackBerry, Windows Mobile) <lecturer, date>

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Making and Exporting a Backup

Assignment 1: Matchismo

Programming Mobile Apps with Python

Cell Phone Operating Systems

The End is Near. Options for File Management and Storage

Mobile Game and App Development the Easy Way

CSCI E-65: Mobile Application Development Using Swift and ios

Datatrans ios Payment Library

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

research: technical implemenation

A LITTLE PROMISE FROM YOU

Example of Standard API

Entering Tizen world for ios & Android developers. Cheng Luo, DukSu Han Samsung Platform Evangelist

Configuration Guide Contigo Mobile Tracker

ALIBI Witness and ALIBI Witness HD Apps for Android - Quick Start Guide

ClickView app for iphone and ipad User manual for admins/teachers

ShareLink 200 Setup Guide

Axxon Monitor. User Manual

ios App Development for Everyone

Additional details >>> HERE <<<

Copyright 2010 The Pragmatic Programmers, LLC.

ios App Development for Everyone

What is Android? originally purchased from Android, Inc. in 2005

Transcription:

Praktikum Entwicklung von Mediensystemen mit Wintersemester 2013/2014 Christian Weiß, Dr. Alexander De Luca

Today Organization Introduction to ios programming Hello World Assignment 1 2

Organization 6 ECTS Bachelor: Vertiefendes Thema Master: Gruppenpraktikum Wednesday 12-14, Geschwister-Scholl-Platz 1 M207 Check your emails (cip / campus) http://www.medien.ifi.lmu.de/lehre/ws1314/pem/ 3

Roadmap October, November: weekly lectures and individual assignments November, December, January: app development in teams, 4 milestone presentations January: final presentation and closing meetings for each team 4

ios Mobile operating system by Apple for iphone, ipad and ipod Touch Based on Unix, derived from OS X Latest release: ios 7 (September 2013) High market share, high user engagement, high willingness to pay for apps. Overall smartphone / tablet market is huge and still growing, and many PEM skills also apply to Android development. 5

Layers of ios Cocoa Touch Multi-touch, Web View, Map Kit, Camera, Image Picker... Media Core Audio, PDF, Core Animation, Quartz 2D, OpenGL... Core Services Core Location, Preferences, Address Book, Preferences... Core OS File System, Kernel, Power Management, Security... 6

User input GUI controls: buttons, sliders, switches etc. Multi-touch gestures: tap, pinch, rotate, swipe, pan, long press Accelerometer: shaking, rotating 7

ios Development 8

Development Environment XCode 9

XCode Source editor: code completion, syntax highlighting, contextsensitive information Interface builder: UI elements library and inspector, split editor to connect UI with code, Storyboards Compiler: C, C++, Objective-C ios Simulator: run and test apps on a Mac More: refactoring, version control, debugging, analysis (https://developer.apple.com/technologies/tools/) 10

XCode Build and run Device and simulator selection Source editor Show/hide sidebars File navigator Utilities sidebar (API info) 11

Contents of an XCode project Source code files (.h and.m) User interface files (.storyboard and.xib) Libraries (.framework) Resources, e.g. images (.png) App configuration file (Info.plist) 12

Objective-C Language for programming ios and Mac apps, also used by Apple to create much of OS X, ios, APIs Strict superset of C, adds syntax for classes, methods, etc. Object-orientated Short introduction: https://developer.apple.com/library/mac/referencelibrary/gettingstarted/ Learning_Objective-C_A_Primer/index.html Detailed introduction: https://developer.apple.com/library/mac/documentation/cocoa/conceptual/ ProgrammingWithObjectiveC/Introduction/Introduction.html 13

Elements of Objective-C Java MyClass.java Methods and method calls Attributes, setters, getters Objective-C Header.h Implementation.m Methods and messages Properties, instance variables * Constructor Interface Garbage Collection Initializer Protocol Automatic Reference Counting (ARC) * * * * Different terminology, but for us very similar to writing Java code 14

Methods Definition (in.h): - (void) dosomething; - (void) dosomethingwitha: (NSString *) a andb: (NSString *) b; Implementation (in.m): - (void) dosomething { // do something } - (void) dosomethingwitha: (NSString *) a andb: (NSString *) b { // do something with a and b } Method call ( message ) (in.m): [self dosomething]; NSString* a = @"a"; NSString* b = @"b"; [self dosomethingwitha:a andb:b]; 15

Properties Auto-creation instance variable, getter and setter The getter has the name of the property ( myproperty ) The name of the setter is get + property name ( getmyproperty ) Definition (in.h): @property(strong, nonatomic) NSString *name; Using getters (in.m): NSString *labeltext = self.name; labeltext = [self name]; Using setters (in.m): [self setname:@"max"]; self.name = @"Max"; Using the instance variable (in.m): _name = @"Max"; strong/weak: refers to ownership. Always use strong except for properties that point to a parent. nonatomic/atomic: use nonatomic to avoid multi-threading issues. self.name: this syntax does NOT access the variable itself. It s a getter/setter, just like the other syntax. _name: Use this instance variable in custom setters/getters and in init-methods only. In any other case, use the getter/setter. 16

Instance Variables ( ivars ) Like private/protected attributes in Java Definition (in.h): NSString* _name; Use (in.m): _name = @"Max"; labeltext = _name; You don t have to use the underscore ( _ ), but it s good practice. Otherwise you accidentally mix up ivars and properties (see next slide). Most of the time it is better to use properties instead 17

Object Initialization Object: MyClass *myobject = [[MyClass alloc] init]; Object with parameter: MyClass *myobject = [[MyClass alloc] initwithparameter: parameter]; String: NSString *hello = @"Hello"; NSString *helloworld = [NSString stringwithformat:@"%@ World", hello]; Array: NSArray *colors = @[@"Green", @"Red", @"Yellow"]; NSMutableArray *mutablecolors = [@[@"Green", @"Red", @"Yellow"] mutablecopy]; If your app doesn t work properly, make sure your objects aren t nil. THERE ARE NO NULL POINTER EXCEPTIONS - Less crashes, more confusion. 18

Objective-C - Example Student.h Student.m #import <Foundation/Foundation.h> #import "Student.h" @interface Student : NSObject @implementation Student @end @end 19

Objective-C - Example Student.h Student.m #import <Foundation/Foundation.h> #import "Student.h" @interface student() @end @interface Student : NSObject @implementation Student @end @end 20

Objective-C - Example Student.h Student.m #import <Foundation/Foundation.h> #import "Student.h" @interface student() @end @interface Student : NSObject @implementation Student @property (strong, nonatomic) NSString *fullname; @property (nonatomic) NSUInteger number; @end @end 21

Objective-C - Example Student.h Student.m #import <Foundation/Foundation.h> #import "Student.h" @interface student() @end @interface Student : NSObject @property (strong, nonatomic) NSString *fullname; @property (nonatomic) NSUInteger number; @implementation Student - (void) setfullname:(nsstring *)fullname { NSLog(@"%@", fullname); _fullname = fullname; } @end @end 22

Hello World New XCode Project: Single View Application In the storyboard, drag a text label and a switch onto the screen 23

Hello World Open the assistant editor and ctrl-drag the text label into ViewController.h. Enter a name and click Connect. You now have access to the UI element in your code. Again, ctrl-drag the switch into the code. This time, select Action instead of Outlet. Change the type from id to UISwitch. Enter a name and click Connect. You now have a listener method that is called by the OS when the user changes the value of our switch. 24

Hello World Close the assistant editor and go to ViewController.m. Complete the IBAction method: - (IBAction)switchChanged:(UISwitch *)sender { NSLog(@"switch changed"); if (sender.on) { self.mylabel.text = @"HelloWorld"; } else { self.mylabel.text = @""; } } Open the debug area and run the code. 25

UIViewController One of the most important classes in ios programming You have to subclass UIViewController when creating a new screen Provides methods for managing the view hierarchy throughout its life cycle and for reacting to events (also great for debugging), e.g. viewdidload: viewwillappear: viewdidappear: viewwilldisappear: viewdiddisappear: - (void)willrotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration; For more see http://developer.apple.com/library/ios/#documentation/uikit/reference/ UIViewController_Class/Reference/Reference.html 26

App Delegate Every app must have an App Delegate. Provides methods for managing the app throughout its life cycle (also great for debugging), e.g. - application:didfinishlaunchingwithoptions: applicationdidbecomeactive: applicationdidenterbackground: applicationwillenterforeground: applicationwillterminate: For more see: http://developer.apple.com/library/ios/#documentation/uikit/reference/ UIApplicationDelegate_Protocol/Reference/Reference.html There are lots of protocols (often named Delegate), e.g. for managing the keyboard, table views, date pickers. 27

Resources Stanford CS 193P iphone Application Development: https://itunes.apple.com/us/course/coding-together-developing/ id593208016 Official documentation: https://developer.apple.com/library/ios Tutorials: http://www.raywenderlich.com/tutorials Solutions to specific problems: Google + Stackoverflow Book: ios Programming: The Big Nerd Ranch Guide by Joe Conway and Aaron Hillegass Developer videos: https://developer.apple.com/videos/ 28

Assignment 1 Individual assignment Get to know XCode and Objective-C Due next Wednesday 10:00, upload to Uniworx Questions? 29