Announcements. Today s Topics

Similar documents
Announcements. Today s Topics

Designing iphone Applications

Why Model-View-Controller?

ios DeCal : Lecture 2 Structure of ios Applications: MVC and Auto Layout

lecture 8 & 9 Data Persistence + AVFoundation & Location

CSE 438: Mobile Application Development Lab 2: Virtual Pet App

iphone Application Programming Lab 2: MVC and Delegation + A01 discussion

View Controllers CPRE 388

Assignment III: Graphing Calculator

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

Lecture 8 Demo Code: Cassini Multithreading

A Better MVC. 300 line view controllers or bust. Dave A guy who thinks too deeply about stuff

View Controller Lifecycle

App. Chapter 19 App. App (ViewController) App. Single View Application Single View Application View. (View Controller)

Announcements. Lab 2 is due next Monday (Sept 25 th ) by 11:59 PM. Late policy is 10% of lab total per day late. So -7.5 points per day late for lab 2

CS193p Spring 2010 Wednesday, March 31, 2010

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013

Cocoa Touch Best Practices

Leveraging Touch Input on ios

Event Delivery: The Responder Chain

Implementing UI Designs in Interface Builder

1 Build Your First App. The way to get started is to quit talking and begin doing. Walt Disney

Mastering UIKit on tvos

Enhancing your apps for the next dimension of touch

The MVC Design Pattern

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011

What s New in imessage Apps

Building GUIs with UIKit. Kevin Cathey

iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5

Advanced ios. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 20 11/01/2012

Developing Applications for ios

Building the App - Part 5 - Adding a Link

ios Memory Deep Dive #WWDC18 Kyle Howarth, Software Engineer James Snee, Software Engineer Kris Markel, Software Engineer

Assignment III: Graphing Calculator

ios Mobile Development

Announcements. Lab 3 is due on Wednesday by 11:59 PM

imessage Apps and Stickers, Part 2

Assignment I: Concentration

ITP 342 Mobile App Development. Model View Controller

lecture 10 UI/UX and Programmatic Design cs : spring 2018

Lecture 24. GUI Applications

ios Development - Xcode IDE

UI Design and Storyboarding

Learn to make desktop LE

Modern User Interaction on ios

Mac OS X and ios operating systems. Lecture 5 Design patterns. Tomasz Idzi

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018

Stanford CS193p. Developing Applications for ios. Spring Stanford CS193p. Spring 2012

Stanford CS193p. Developing Applications for ios. Spring CS193p. Spring 2016

Assignment III: Graphing Calculator

Stanford CS193p. Developing Applications for ios. Winter CS193p. Winter 2017

Building Mapping Apps for ios With Swift

ITP 342 Mobile App Development. Data Persistence

INTRODUCTION TO ARCHITECTING YOUR IOS APP

SAMPLE CHAPTER. Brendan G. Lim Martin Conte Mac Donell MANNING

User Experience: Windows & Views

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

Settings. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Assignment III: Graphing Calculator

S A M P L E C H A P T E R

Mobile Application Programing: ios. Messaging

Navigation and Segues

CSC 581: Mobile App Development Spring 2019

Touch Bar Fundamentals

Registering for the Apple Developer Program

Social Pinboard: ios(swift) Application

Document Version Date: 1st March, 2015

Assignment IV: Smashtag Mentions

iphone Application Programming Lab 3: Swift Types and Custom Operator + A02 discussion

CS193P - Lecture 7. iphone Application Development. Navigation & Tab Bar Controllers

Maxime Defauw. Learning Swift

CS193P: HelloPoly Walkthrough

Object-Oriented Programming in Objective-C

Widget Tour. iphone and ipod touch Development Fall 2009 Lecture 7

Your First iphone OS Application

Lecture 24. GUI Applications

Mastering Drag and Drop

Running Code on an ios Device. Appendix. The ios Developer Program

Stanford CS193p. Developing Applications for ios. Spring CS193p. Spring 2016

ios Application Development Lecture 5: Protocols, Extensions,TabBar an Scroll Views

Your First iphone Application

Introductory ios Development

Quick Interaction Techniques for watchos

What s New in NSCollectionView Session 225

Structuring an App Copyright 2013 Apple Inc. All Rights Reserved.

} override func didreceivememorywarning() { 26 super.didreceivememorywarning() 27 } 28 } Pause Stop

MVC & Onwards. CS 442: Mobile App Development Michael Saelee

Model-View-Controller Architecture

Tables. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need

iphone Application Tutorial

ITP 342 Mobile App Dev. Table Views

Stanford CS193p. Developing Applications for ios. Winter CS193p. Winter 2017

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

What s New in tvos #WWDC16. App Frameworks. Session 206. Hans Kim tvos Engineer

Mobile Development Lab 3

Stanford CS193p. Developing Applications for ios. Winter CS193p! Winter 2015

Media and Gaming Accessibility

Intro to Development for ios. Dave Koziol Arbormoon Software, Inc.

News- ipad: ios(swift) Application

Transcription:

Announcements Lab 2 is due tonight by 11:59 PM Late policy is 10% of lab total per day late So -7.5 points per day late for lab 2 Labs 3 and 4 are posted on the course website Extensible Networking Platform 1 1 - CSE 438 Mobile Application Development Today s Topics Finish Circle Drawing App Designing iphone Applications Model-View-Controller (Why and How?) View Controllers Extensible Networking Platform 2 2 - CSE 438 Mobile Application Development

Circle Drawing App Extensible Networking Platform 3 3 - CSE 438 Mobile Application Development Designing iphone Applications Extensible Networking Platform 4 4 - CSE 438 Mobile Application Development

Different Flavors of Mail Extensible Networking Platform 5 5 - CSE 438 Mobile Application Development Organizing Content Extensible Networking Platform 6 6 - CSE 438 Mobile Application Development

Organinzing Content Focus on your user s data One thing at a time Screenfuls of content Extensible Networking Platform 7 7 - CSE 438 Mobile Application Development Patterns for Organizing Content Navigation Bar Tab Bar Extensible Networking Platform 8 8 - CSE 438 Mobile Application Development

Navigation Bar Hierarchy of content Drill down into greater detail Extensible Networking Platform 9 9 - CSE 438 Mobile Application Development Tab Bar Self-contained modes Extensible Networking Platform 10 10 - CSE 438 Mobile Application Development

A Screenful of Content Slice of your application Views, data, logic Extensible Networking Platform 11 11 - CSE 438 Mobile Application Development Parts of a Screenful Extensible Networking Platform 12 12 - CSE 438 Mobile Application Development

Parts of a Screenful Extensible Networking Platform 13 13 - CSE 438 Mobile Application Development Model-View-Controller (Why and How?) Extensible Networking Platform 14 14 - CSE 438 Mobile Application Development

Why Model-View-Controller? Ever used the word spaghetti to describe code? Clear responsibilities make things easier to maintain Avoid having one monster class that does everything Extensible Networking Platform 15 15 - CSE 438 Mobile Application Development Why Model-View-Controller? Separating responsibilities also leads to reusability By minimizing dependencies, you can take a model or view class you ve already written and use it elsewhere Think of ways to write fewer lines of code Extensible Networking Platform 16 16 - CSE 438 Mobile Application Development

Communication and MVC KVO, notifications KVO, notifications target-action, delegation Extensible Networking Platform 17 17 - CSE 438 Mobile Application Development View Controllers Extensible Networking Platform 18 18 - CSE 438 Mobile Application Development

Problem: Managing a Screenful Controller manages views, data and application logic Apps are made up of many of these Would be nice to have a well-defined starting point A la UIView for views Common language for talking about controllers Extensible Networking Platform 19 19 - CSE 438 Mobile Application Development Problem: Building Typical Apps Some application flows are very common Navigation-based Tab bar-based Combine the two Don t reinvent the wheel Plug individual screens together to build an app Extensible Networking Platform 20 20 - CSE 438 Mobile Application Development

UIViewController Basic building block Manages a screenful of content Subclass to add your application logic View Controller Extensible Networking Platform 21 21 - CSE 438 Mobile Application Development Your and Apple View Controllers Create your own UIViewController subclass for each screenful Plug them together using existing composite view controllers Extensible Networking Platform 22 22 - CSE 438 Mobile Application Development

Your and Our View Controllers Create your own UIViewController subclass for each screenful Plug them together using existing composite view controllers Extensible Networking Platform 23 23 - CSE 438 Mobile Application Development import UIKit Your View Controller Subclass class MyViewController : UIViewController { // A view controller will usually // manage views and data var mydata = [String]() // And respond to actions @IBAction func dosomeaction(_ sender: UIButton) { // Do something here when button pressed } } Extensible Networking Platform 24 24 - CSE 438 Mobile Application Development

The View in View Controller UIViewController superclass has a view property view: UIView Loads lazily On demand when requested OS figures this out Can be purged on demand as well (low memory) Sizing and positioning the view? Depends on where it s being used Don t make assumptions, be flexible Extensible Networking Platform 25 25 - CSE 438 Mobile Application Development Don t do it! When to call -loadview? Cocoa tends to embrace a lazy philosophy Call setneedsdisplay() instead of draw(_:) Allows work to be deferred Performance! Consider time to launching an application Extensible Networking Platform 26 26 - CSE 438 Mobile Application Development

View Controller Lifecycle override func viewdidload() { // Your view has been loaded // Customize it here if needed view.someweirdproperty = true } Extensible Networking Platform 27 27 - CSE 438 Mobile Application Development View Controller Lifecycle override func viewwillappear(_ animated: Bool) { super.viewwillappear(animated) // Your view is about to show on the screen beginloadingdatafromtheweb() startshowingloadingprogress() } Extensible Networking Platform 28 28 - CSE 438 Mobile Application Development

View Controller Lifecycle override func viewwilldisappear(_ animated: Bool) { } super.viewwilldisappear(animated) // Your view is about to leave the screen rememberscrollposition() savedatatodisk() Extensible Networking Platform 29 29 - CSE 438 Mobile Application Development Navigation View Controller Demo Extensible Networking Platform 30 30 - CSE 438 Mobile Application Development

Loading and Saving Data Lots of options out there, depends on what you need UserDefaults Property lists SQLite Web services Covering in greater depth in a few lectures Extensible Networking Platform 31 31 - CSE 438 Mobile Application Development Saving State Across App Launches UserDefaults (renamed from NSUserDefaults) to read and write prefs & state Singleton object: UserDefaults.standard Methods for storing & fetching common types: integer(forkey: String) set(value: Int, forkey: String) Find an appropriate time to store and restore your state Extensible Networking Platform 32 32 - CSE 438 Mobile Application Development

UserDefaults Demo Extensible Networking Platform 33 33 - CSE 438 Mobile Application Development