Introductory ios Development

Size: px
Start display at page:

Download "Introductory ios Development"

Transcription

1 Introductory ios Development Unit 5 - Multi-View Apps Quick Links & Text References What is a Delegate? What is a Protocol? Delegates, Protocols and TableViews Creating a Master-Detail App Modifying the Master-Detail Template Sending Data from Master View to Detail View Modifying Detail View to Allow Editing UINavigationController Sharing the Collection Sending a Record to the Detail View Adding a Record Showing the Details Saving the Changes / New Data Updating the TableView Deleting Records Custom Cell Layouts Animating the Segues ich.com/75289/swifttutorial-part-3-tuplesprotocols-delegatestable-views Page 1 of 16

2 What is a Delegate? source ios Developer Library Delegates are objects that implement certain functions when it doesn't make sense to implement those functions on the normal object. Delegation is when an object will pass the responsibility of handling an event to another object thus "delegating" the responsibility to that object. Allows an object to act on behalf of another. Delegates allow you share data between classes The main value of delegation is that it allows you to easily customize the behavior of several objects in one central object. The advantage of the delegate design pattern is loose coupling. It enables class A (the delegate) to depend on class B (the delegating class) without class B having to have any knowledge of class A. This ensures that the dependency relationship is one-way only, rather than being circular. What is a Protocol? Timer Sample ObjC Guide for Developers A minimum interface that a class needs to implement to interact with another class Delegates contain protocols Protocols define how to communicate with the delegate Methods defined in the protocol Methods that must be implemented by classes delegating to protocol Properties that are available Page 2 of 16

3 Delegates, Protocols and TableViews Source ObjC Guide for Developers Delegation helps to separate models from controllers (MVC). Such as in John Cartwright's example: a UITableView knows how to display rows and sections. It knows how to reuse UITableViewCells for performance reasons. It knows all of the other stuff a UIScrollView knows. But it doesn't know which cells to display. know what to populate those cells with. which cells to reuse for a given NSIndexPath. This really should be the job of the controller, anyways. Delegation allows the table view to offload this non-view logic onto an object that should have that responsibility anyways. More than that, you're not locked into one delegate for the entire lifetime of an object. You could very easily have multiple data sources for a given UITableView and switch them around at run time as needed. Creating a Master-Detail App Master/Detail apps include a table view in the master scene that segues into a details scene when the user clicks one of elements in the table view. Create a new project Master-Detail Application m/swift/buildingswift-app-tutorial Part 2 Part 3 Page 3 of 16

4 The primary scene in a Master-Detail app is a UITableViewController. This is primarily comprised of a UITableView that displays a scrollable list of data displayed in cells. A UITableView defines two protocols that declare what methods it expects two other classes, called the data source and the delegate, to implement to be able to retrieve the information it needs. Since the protocols are separated, the two classes can also be separated, but they are generally the same class. The data source implements methods that tell the table view how many items and sections there should be and provides them when the table view asks for them to display them on screen. The delegate provides information on the visualization of these items, like the kind and size of views used to represent items (cells). Also what events to handle. TableViewController contains both delegates Cell Reuse UITableViews only show enough cells to fill the screen plus a couple to improve scrolling. Those cells are reused with different data when you scroll Add standard code to tableview:cellforrowatindexpath Page 4 of 16

5 Many details of the table view controller are taken care of for you: Navigation controller is created that links to a table view controller (that contains a table view) Nav Controller provides a common (dynamic) navigation bar For now, I recommend turning off Auto Layout This example assumes you re using an iphone layout ipad layout and processing is different Table View controller class is set to the table view controller that was created (see Identity Inspector with table view controller selected in Storyboard) Table view already contains a prototype cell Details of how each list item looks on the screen Reuse identifier already defined (Cell) Select Cell in outline and Attributes Inspector Consider changing Identifier Detail View is created that is linked to the table view controller via segue Master view controller includes a private collection of objects used to populate the table view We will be replacing this with our own collection Buttons added to master view controller to edit and add items Code to add new items to the list (insertnewobject) Linked to add button above Required prototypes for table view numberofsectionsintableview numberofrowsinsection cellforrowatindexpath Includes reusable cells caneditrowatindexpath commiteditingstyleforrowatindexpath prepareforsegue Used to switch to detail view When cell touched (connection defined) Page 5 of 16

6 Many details of the Detail View are taken care of for you: A detail item property that will hold the item selected in the list Detail item outlet created pointing to label to display detail information Prototypes for managing the detail detailitem configureview viewdidload Project can be run as is Adding items simply adds the current date / time Edit allows you delete items Click item to switch to Detail View (can come back) Modifying the Master-Detail Template First create a class to store the data each table item should represent In master, viewdidload, fill array with sample data In master, cellforrowatindexpath Change object type to match yours Consider changing _objects name Transfer appropriate field from class to textlabel.text detailtextlabel.text FamilyMember: first, last, birthday Display first name + last name Modify insertnewobject Create new class object (from detail form?) We will create our own version of this later Comment out insertnewobject Sending Data from the Master View to the Detail View Modify prepareforsegue Send your class instead of NSDate Modify Detail View Modify detailitem: change type to YourClass Modify configureview to display what you want Receive FamilyMember object Page 6 of 16

7 Modifying Detail View to Allow Editing Modify detail view to accept data into input fields (instead of label) Need a way to get data changes from detail view back to master view. In order to get back from Detail View to Master View, we ll first have to add a Navigaton Controller between them. Nav Controller allows adding buttons to the navigation bar Display names in Text Fields, birth date in DateTime picker formatted Date only Test. UINavigationController Navigation controller (controller in MVC) maintains a stack of other ViewControllers Provides means to navigate between them Buttons that change as views change Starting View Controller is aka root view controller Zoom storyboard to 50% Add a Navigation Controller to the storyboard Delete the Root View Controller that comes with the Nav Controller Delete the segue between the original master view controller and detail view controller Move the Navigation Controller between the master and detail view Ctrl-drag from the Prototype Cell in Master View Controller to the Navigation Controller Choose modal as the segue type Modal is similar to a dialog in Windows that stops all other app processing until the view is closed/returned Change segue Identifier (Attributes) to showdetails Ctrl-drag from Nav Controller to Detail View Choose root view controller This designates that the detail view actually comprises the contents of the view Follow instructions Page 7 of 16

8 Add an Add Bar Button Item to the right side of the Master View Controller nav bar Ctrl-drag from the Add button to the Detail view Nav Controller Choose modal as the segue type Change the segue Identifier to AddItem (or something like that) Add two Bar Button Items to the Detail view Drag to left side of Nav Bar in Detail view Change Identifier (Attributes) to Cancel Drag to right side of Nav Bar in Detail view Change Identifier to Save Create a DismissSegue class A segue that dismisses one view (modal) to return to another is not automatically defined. Once it is defined, it is available for all segues to use (appears in popup menu) FileNewFile ioscocoa Touch Class This designates the class will subclass a built-in touch class Class (name): DismissSegue Subclass of UIStoryBoardSegue Language: Swift Note: have to to class definition or nav button doesn t know what to return to May be fixed in later versions of Xcode/Swift Define DismissSegue import DismissSegue: UIStoryboardSegue { override func perform() { if let controller = sourceviewcontroller.presentingviewcontroller? { controller.dismissviewcontrolleranimated(true, completion:nil) //end if //end perform //end class Page 8 of 16

9 Connect Detail View buttons to Master View Ctrl-drag Cancel button to Master View Controller Choose dismiss in popup Important: change Identifier (Attributes) to dismissandcancel Ctrl-drag Save button to Master View Controller Choose dismiss in popup Important: change Identifier (Attributes) to dismissandsave Create segues Sharing the Collection Now, we need some way to share our data collection between the two views (Master and Details) There are definitely other ways to do this, but I believe creating a static array is the easiest Define a new class (FileNewFileiOS Swift File Name the class appropriately for a collection of your program s objects This class will only contain one property a classlevel, shared array of objects It will also contain methods to manipulate the array elements Define the Family class Page 9 of 16

10 class ClassName { //Create the single instance of the array //Initialized automatically first time referenced class var pluralclassname: YourClassName { struct Static static let instance = pluralclassname(); //Instantiate return Static.instance //end static class var pluralobjects: [pluralobjectname]=[] //internal array var count: Int { return pluralobjects.count func addobject(newobject: YourClassName) { pluralobjects.append(newobject) func get(index: Int) -> YourClassName { return pluralobjects[index] func removeatindex(index: Int) { pluralobjects.removeatindex(index)) func replace(newobject: YourClassName, index:int) { pluralobjects[index] = newobject //end class This class is a wrapper class. It wraps around an array of your objects It provides additional functionality by making the array static, available to all other classes (ViewControllers in our case) Basically, makes the array a global variable Since it wraps around the array, the wrapper class must provide access to the functionality of the array. External users don t have access to the internal array The methods we define provide that access. Replace: ClassName with a singular name to be used externally for the array of objects (Family) pluralclassname with external name of the array (members) YourClassName with the name of your class (FamilyMember) pluralobjects with the internal name of the array (themembers) Object with an appropriate substitute for your program (Member) Page 10 of 16

11 pluralclassname is the name used external to the class to access our array It is defined as a class variable (shared by all instances if there were more than one) It s not an array itself, but it contains our internal array, so it s often treated like an array. pluralobjects is the name of the array used internal to the class count is a property that mimics the array count property (provides access to the internal array s count) add allows the user class to add a new element to the internal array get returns the element (or your program class) at the given index removeatindex allows the user class to delete an element from the array replace allows the user class to replace an element in the array with an updated version of that element Note: we don t edit elements of the array; we replace the element with an updated version. Sending a Record to the Detail View Now that the array of data is shared, we don t actually have to send data to the Detail View it already has access to the complete array. We do have to tell the Detail View which record we want displayed However, there are two ways we might transfer control to the Detail View Add new record (+) Click a cell (edit record) When the user clicks a cell to see/edit the details, all we have to do is send the index of the selected cell to the Detail View The Detail View will then display the corresponding element in the array. When the user clicks + to all a new element, we won t send anything to the Detail View. The Detail View will sense this and display an empty record. Page 11 of 16

12 To prepare, we ll first add a variable to Detail View to hold the selected index Above all functions: var selectedindex: Int? Note this is an optional variable, allowing it to be undefined when the request is to add a new record. Remove the detail variable initially defined when the project was created. Add memberindex? to detail view Now, we need to send the selected cell index from the Master View to the Detail View prepareforsegue should already have an If statement that checks which segue is being used and another If statement that ensures a cell has been selected, unwrapping the row data. If the selected segue is showdetails (cell was tapped), we need to send the index of the cell to the Detail View We can t simply send the index from Master to Detail View however, because there s a Nav Controller in between. ((segue.destinationviewcontroller as UINavigationController).topViewController as DetailViewController).selectedIndex = indexpath.row Send the index to Detail View Whew! First we grab the segue s destination which we know to be a Nav Controller. Then we grab the Nav Controller s top View Controller which we know is a DetailViewController Nav Controller s can have a whole stack of Views to control Now we have a pointer to our Detail View which gives us access to the selectedindex variable which we set to the index of the selected cell in the Table View. Adding a Record Nothing to do here. If the segue is not showdetails, we simply segue to the Detail View without sending anything. The index will be undefined, letting the Detail View know we re adding a new record. Page 12 of 16

13 Showing the Details Nothing to it really. We simply use the index sent by the Master View to retrieve the corresponding object from the static array class If the index is undefined, we simply leave the default values of the form objects (blank) Could set some other default values if appropriate Show details Test In configureview (Detail View): if let index: Int = self.selectedindex { var obj = ClassName.pluralClassName.get(index) //Transfer class members to View objects The first statement checks to see if the selectedindex is set and unwraps it (it s optional) if it is. If the selectedindex is set, the corresponding array element is retrieved Note to access the array, you must first designate the class name (because the array is a class variable), then provide the external name of the array (not really an array, but let s not get technical). Finally, the data members of the array element are transferred to the corresponding View objects (TextView, Switch, etc.) If the selectedindex is NOT set, nothing is done View objects are left in their default states Could add an else and define specific default values if appropriate. Saving the Changes / New Data We ll know the user s done editing when they click either the Cancel or Save button, causing the segue to occur In prepareforsegue (Detail View) If the segue ID is dismissandcancel, do nothing. Simply dismiss the Detail View and return to the Master View (no code required) Page 13 of 16

14 if segue.identifer == "dismissandsave" { //newobj: Instantiate new object and fill with form object data if index: Int = self.selectedindex { ClassName.pluralClassName.replace(newObj, atindex: index) else { ClassName.pluralClassName.add(newObj) If we re saving, create a new instance of YourClassName and fill it with the data from the scene (that the user entered) Then, we once again unwrap the selectedindex If it exists, we replace the existing element in the array with the new one. If it doesn t exist, we add the new element to the array. Done! Now we can return to the Master View Save details Test Updating the TableView If you test the program now, you ll see that new records add and are immediately displayed in the TableView. However, the changes to existing records are not displayed. However, if you return to Detail View you ll they were saved. This seems to have something to do with how Swift senses changes to the array. If there s a new element, add it. If the element already exists (even though we replaced it with a new one), it already exists so no need to refresh. We need to tell the Master View to refresh the TableView whenever we return from the Detail View Simply add a new event handler: override func viewwillappear(animated: Bool) { self.tableview.reloaddata() viewwillappear is built-in to the TableViewController we re simply overriding it s behavor (should super class behavior be invoked?) When the View reappears, we tell the tableview (which is also predefined in the TableViewController) to reload its data. Page 14 of 16

15 Deleting Records One final step. When the user chooses to delete a cell from the Table View, we also have to remove it from the array In tableview:commiteditingstyle, if we re deleting, add code to remove from the array as well: ClassName.pluralClassName.removeAtIndex(indexPath.row) Custom Cell Layouts Change Style attribute to Custom Drag labels, text views, images etc to prototype Option 1 Assign unique numbers (10, 20, 30, etc) to the Tag attribute for each object In cellforrowatindexpath:indexpath add code to point to the object let lblname = cell.viewwithtag(10) as UILabel; Option 2 (Better?) Create a custom UITableViewCell subclass FileNewFileCocoa Touch Name it and change subclass of to UITableViewCell Change Import Cocoa to UIKit In the class, manually add outlets for the objects in the weak var objname: UIType! Change objname and UIType as appropriate In the storyboard, select the prototype cell Select Identity Inspector Change the class name to your new subclass name Connect the cell objects to their IBOutlets Open the document outline Open Connections Inspector Select a cell object Drag from Referencing Outlets to SUBCLASS in outline (first item under Table View) Select object from popup list Page 15 of 16

16 In MasterViewController, change the type of *cell (in dequeue command) to the new subclass name These objects are now part of the cell object cell.lblname.text = "Volker"; Animating the Segues Click the segue icon between table view controller and nav controller that follows it Access the Attributes inspector Change transition Page 16 of 16

ITP 342 Mobile App Dev. Table Views

ITP 342 Mobile App Dev. Table Views ITP 342 Mobile App Dev Table Views Tables A table presents data as a scrolling, singlecolumn list of rows that can be divided into sections or groups. Use a table to display large or small amounts of information

More information

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

Stanford CS193p. Developing Applications for ios. Winter CS193p! Winter 2015 Stanford CS193p Developing Applications for ios Today UITextField Bonus Topic! Table View A UIView for displaying long lists or tables of data UITextField Like UILabel, but editable Typing things in on

More information

ITP 342 Mobile App Dev. Table Views

ITP 342 Mobile App Dev. Table Views ITP 342 Mobile App Dev Table Views Table Views The most common mechanism used to display lists of data to the user Highly configurable objects that can be made to look practically any way you want them

More information

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

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall Stanford Developing Applications for ios Today Drag and Drop Transferring information around within and between apps. EmojiArt Demo Drag and drop an image to get our EmojiArt masterpieces started. UITableView

More information

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

Tables. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Tables Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline Table View Controller Table View Table Cells

More information

ios Mobile Development

ios Mobile Development ios Mobile Development Today UITableView! Data source-driven vertical list of views.! ipad! Device-specific UI idioms.! Demo! Shutterbug UITableView Very important class for displaying data in a table!

More information

Chapter 22 TableView TableView. TableView ios. ViewController. Cell TableViewCell TableView

Chapter 22 TableView TableView. TableView ios. ViewController. Cell TableViewCell TableView Chapter 22 TableView TableView Android TableView ListView App 22.1 TableView TableView Storyboard Table View ViewController TableView ios Cell TableViewCell TableView Table View Cell Cell ImageView (imageview)

More information

News- ipad: ios(swift) Application

News- ipad: ios(swift) Application News- ipad: ios(swift) Application Document Version 1.0.1 Date: 9 th Nov, 2014 2 [NEWS- IPAD: APP DOCUMENTATION] Important Notes:... 6 AppDelegate Class Reference... 7 Tasks... 7 Instance Methods... 7

More information

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

Structuring an App Copyright 2013 Apple Inc. All Rights Reserved. Structuring an App App Development Process (page 30) Designing a User Interface (page 36) Defining the Interaction (page 42) Tutorial: Storyboards (page 47) 29 App Development Process Although the task

More information

Document Version Date: 1st March, 2015

Document Version Date: 1st March, 2015 7 Minute Fitness: ios(swift) Application Document Version 1.0.1 Date: 1st March, 2015 2 [7 MINUTE FITNESS: APP DOCUMENTATION] Important Notes:... 5 AppDelegate Class Reference... 6 Tasks... 6 Instance

More information

Assignment IV: Smashtag Mentions

Assignment IV: Smashtag Mentions Assignment IV: Smashtag Mentions Objective In this assignment, you will enhance the Smashtag application that we built in class to give ready-access to hashtags, urls, images and users mentioned in a tweet.

More information

Protocols and Delegates. Dr. Sarah Abraham

Protocols and Delegates. Dr. Sarah Abraham Protocols and Delegates Dr. Sarah Abraham University of Texas at Austin CS329e Fall 2016 Protocols Group of related properties and methods that can be implemented by any class Independent of any class

More information

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

MVC & Onwards. CS 442: Mobile App Development Michael Saelee MVC & Onwards CS 442: Mobile App Development Michael Saelee Agenda - Recap: view-controller communication - Delegation as a general pattern - Observer pattern - Controller responsibilities & MVC - Multiple

More information

Navigation and Segues

Navigation and Segues Navigation and Segues Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline Multiple views Segues Navigation

More information

A Mad Libs app that you will navigate through 3 UIViewControllers to add text that will be shown in a story on the fourth UIViewController.

A Mad Libs app that you will navigate through 3 UIViewControllers to add text that will be shown in a story on the fourth UIViewController. WordPlay App: A Mad Libs app that you will navigate through 3 UIViewControllers to add text that will be shown in a story on the fourth UIViewController. Create a new project Create a new Xcode project

More information

Social Pinboard: ios(swift) Application

Social Pinboard: ios(swift) Application Social Pinboard: ios(swift) Application Document Version 1.0.1 Date: 15 th May, 2015 2 [SOCIAL PINBOARD: APP DOCUMENTATION] Important Notes:... 5 AppDelegate Class Reference... 6 Tasks... 6 Instance Methods...

More information

Mobile Development - Lab 2

Mobile Development - Lab 2 Mobile Development - Lab 2 Objectives Illustrate the delegation mechanism through examples Use a simple Web service Show how to simply make a hybrid app Display data with a grid layout Delegation pattern

More information

ITP 342 Mobile App Dev. Collection View

ITP 342 Mobile App Dev. Collection View ITP 342 Mobile App Dev Collection View Collection View A collection view manages an ordered collection of items and presents them in a customizable layout. A collection view: Can contain optional views

More information

Assignment III: Graphing Calculator

Assignment III: Graphing Calculator Assignment III: Graphing Calculator Objective The goal of this assignment is to reuse your CalculatorBrain and CalculatorViewController objects to build a Graphing Calculator for iphone and ipad. By doing

More information

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

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011 Developing Applications for ios Today UI Element of the Week UIToolbar ipad Split View Popover Universal (iphone + ipad) Application Demo Friday Section AVFoundation framework - Capturing and manipulating

More information

Building Mapping Apps for ios With Swift

Building Mapping Apps for ios With Swift Building Mapping Apps for ios With Swift Jeff Linwood This book is for sale at http://leanpub.com/buildingmappingappsforioswithswift This version was published on 2017-09-09 This is a Leanpub book. Leanpub

More information

Lecture 8 Demo Code: Cassini Multithreading

Lecture 8 Demo Code: Cassini Multithreading Lecture 8 Demo Code: Cassini Multithreading Objective Included below is the source code for the demo in lecture. It is provided under the same Creative Commons licensing as the rest of CS193p s course

More information

Learn to make desktop LE

Learn to make desktop LE HACKING WITH SWIFT COMPLETE TUTORIAL COURSE Learn to make desktop LE P apps with real-worldam S Swift projects REEPaul Hudson F Project 1 Storm Viewer Get started coding in Swift by making an image viewer

More information

Learn to make ios apps

Learn to make ios apps HACKING WITH SWIFT PROJECTS 1-39 Learn to make ios apps E L P with real projects SAM E E FR Paul Hudson Project 1 Storm Viewer Get started coding in Swift by making an image viewer app and learning key

More information

Assignment III: Graphing Calculator

Assignment III: Graphing Calculator Assignment III: Graphing Calculator Objective You will enhance your Calculator to create a graph of the program the user has entered which can be zoomed in on and panned around. Your app will now work

More information

CS193P - Lecture 8. iphone Application Development. Scroll Views & Table Views

CS193P - Lecture 8. iphone Application Development. Scroll Views & Table Views CS193P - Lecture 8 iphone Application Development Scroll Views & Table Views Announcements Presence 1 due tomorrow (4/28)! Questions? Presence 2 due next Tuesday (5/5) Announcements Enrolled students who

More information

ITP 342 Mobile App Dev. Interface Fun

ITP 342 Mobile App Dev. Interface Fun ITP 342 Mobile App Dev Interface Fun Human Interface Guidelines ios Human Interface Guidelines https://developer.apple.com/ library/ios/documentation/ userexperience/conceptual/ MobileHIG/index.html 2

More information

ADVANCED M A. Learn SiriKit, imessage apps, rich notifications, and more. with real-world projects HACKING WITH SWIFT COMPLETE TUTORIAL COURSE

ADVANCED M A. Learn SiriKit, imessage apps, rich notifications, and more. with real-world projects HACKING WITH SWIFT COMPLETE TUTORIAL COURSE HACKING WITH SWIFT ADVANCED ios VOLUME ONE COMPLETE TUTORIAL COURSE Learn SiriKit, imessage apps, E L P rich notifications, and more M A S with real-world projects E E FR Paul Hudson Chapter 1 Happy Days

More information

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

App. Chapter 19 App. App (ViewController) App. Single View Application Single View Application View. (View Controller) Chapter 19 App App (ViewController) App 19.1 App App Single View Application Single View Application View Controller View Controller Label Button Button (View Controller) 2 View Controller Utility Area

More information

ITP 342 Mobile App Dev. Interface Components

ITP 342 Mobile App Dev. Interface Components ITP 342 Mobile App Dev Interface Components Human Interface Guidelines ios Human Interface Guidelines (HIG) https://developer.apple.com/ library/ios/documentation/us erexperience/conceptual/m obilehig/index.html

More information

Today s Topics. Scroll views Table views. UITableViewController Table view cells. Displaying data Controlling appearance & behavior

Today s Topics. Scroll views Table views. UITableViewController Table view cells. Displaying data Controlling appearance & behavior Today s Topics Scroll views Table views Displaying data Controlling appearance & behavior UITableViewController Table view cells Scroll Views UIScrollView For displaying more content than can fit on the

More information

My First iphone App (for Xcode version 6.4)

My First iphone App (for Xcode version 6.4) My First iphone App (for Xcode version 6.4) 1. Tutorial Overview In this tutorial, you re going to create a very simple application on the iphone or ipod Touch. It has a text field, a label, and a button

More information

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

1 Build Your First App. The way to get started is to quit talking and begin doing. Walt Disney 1 Build Your First App The way to get started is to quit talking and begin doing. Walt Disney Copyright 2015 AppCoda Limited All rights reserved. Please do not distribute or share without permission. No

More information

Assignment III: Graphing Calculator

Assignment III: Graphing Calculator Assignment III: Graphing Calculator Objective You will enhance your Calculator to create a graph of the program the user has entered which can be zoomed in on and panned around. Your app will now work

More information

COMPLETE TUTORIAL COURSE. Learn to make tvos LE. apps with real-worldam S F

COMPLETE TUTORIAL COURSE. Learn to make tvos LE. apps with real-worldam S F HACKING WITH SWIFT COMPLETE TUTORIAL COURSE Learn to make tvos LE P apps with real-worldam S Swift projects REEPaul Hudson F Project 1 Randomly Beautiful 2 www.hackingwithswift.com Setting up In this first

More information

Index. btndrop function, 224, 226 btngetquote function, 246 btnpressed function, 28 btnquote method, 245. CallWeb method, 238, 240

Index. btndrop function, 224, 226 btngetquote function, 246 btnpressed function, 28 btnquote method, 245. CallWeb method, 238, 240 Index A App icons section icons set, 277 LaunchImage, 278 launch screen graphics, 278 279 PNG format, 277 settings, 276 App store deployment application graphics, 273 general settings Identity section,

More information

User Experience: Windows & Views

User Experience: Windows & Views View Controller Programming Guide for ios User Experience: Windows & Views 2011-01-07 Apple Inc. 2011 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval

More information

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

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall Stanford Developing Applications for ios Today More about Documents Demo Use Codable to create a JSON representation of our document Store it in the filesystem Think better of that and let UIDocument store

More information

CS193P: HelloPoly Walkthrough

CS193P: HelloPoly Walkthrough CS193P: HelloPoly Walkthrough Overview The goal of this walkthrough is to give you a fairly step by step path through building a simple Cocoa Touch application. You are encouraged to follow the walkthrough,

More information

ITP 342 Mobile App Dev. Delegates

ITP 342 Mobile App Dev. Delegates ITP 342 Mobile App Dev Delegates Protocol A protocol is a declaration of a list of methods Classes that conform to the protocol implement those methods A protocol can declare two kinds of methods: required

More information

CSC 581: Mobile App Development Spring 2019

CSC 581: Mobile App Development Spring 2019 CSC 581: Mobile App Development Spring 2019 Unit 1: Getting Started with App Development Xcode installing XCode, creating a project, MVC pattern interface builder, storyboards, object library outlets vs.

More information

HACKING WITH SWIFT. Practical. ios 10 COMPLETE TUTORIAL COURSE. Learn to develop apps. for ios 10 by building MP. real-world projects E S

HACKING WITH SWIFT. Practical. ios 10 COMPLETE TUTORIAL COURSE. Learn to develop apps. for ios 10 by building MP. real-world projects E S HACKING WITH SWIFT Practical ios 10 COMPLETE TUTORIAL COURSE Learn to develop apps E L for ios 10 by building MP A real-world projects E S E FR Paul Hudson Chapter 1 Happy Days www.hackingwithswift.com

More information

Apple Development Technology Workshops

Apple Development Technology Workshops Apple Development Technology Workshops Workshop 10 Table Views Building iphone Apps. Pt 2 Fall 2008 Hafez Rouzati Fall 2008 Zach Pousman Last Week UIViewControllers Organizing Content & Building iphone

More information

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

Stanford CS193p. Developing Applications for ios. Spring CS193p. Spring 2016 Stanford Developing Applications for ios Today Memory Management for Reference Types Controlling when things leave the heap Closure Capture Closures capture things into the heap too Extensions A simple,

More information

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

S A M P L E C H A P T E R SAMPLE CHAPTER Anyone Can Create an App by Wendy L. Wise Chapter 5 Copyright 2017 Manning Publications brief contents PART 1 YOUR VERY FIRST APP...1 1 Getting started 3 2 Building your first app 14 3 Your

More information

ios Core Data Example Application

ios Core Data Example Application ios Core Data Example Application The Core Data framework provides an abstract, object oriented interface to database storage within ios applications. This does not require extensive knowledge of database

More information

Mobile Application Development

Mobile Application Development Mobile Application Development Lecture 16 Controllers of View Controllers 2013/2014 Parma Università degli Studi di Parma Lecture Summary Multiple MVCs UINavigationController Segues UITabBarController

More information

Object-Oriented Programming in Objective-C

Object-Oriented Programming in Objective-C In order to build the powerful, complex, and attractive apps that people want today, you need more complex tools than a keyboard and an empty file. In this section, you visit some of the concepts behind

More information

Praktikum Entwicklung von Mediensystemen mit

Praktikum Entwicklung von Mediensystemen mit Praktikum Entwicklung von Mediensystemen mit Wintersemester 2013/2014 Christian Weiß, Dr. Alexander De Luca Today Table View Navigation Controller Passing Data Between Scenes Assignment 2 2 Navigation-based

More information

ITP 342 Mobile App Dev. Connections

ITP 342 Mobile App Dev. Connections ITP 342 Mobile App Dev Connections User Interface Interactions First project displayed information to the user, but there was no interaction. We want the users of our app to touch UI components such as

More information

ios 101 Hands-On Challenges

ios 101 Hands-On Challenges ios 101 Hands-On Challenges Copyright 2014 Razeware LLC. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed by

More information

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

ios DeCal : Lecture 2 Structure of ios Applications: MVC and Auto Layout ios DeCal : Lecture 2 Structure of ios Applications: MVC and Auto Layout Overview : Today s Lecture Model View Controller Design Pattern Creating Views in Storyboard Connecting your Views to Code Auto

More information

Assignment II: Calculator Brain

Assignment II: Calculator Brain Assignment II: Calculator Brain Objective You will start this assignment by enhancing your Assignment 1 Calculator to include the changes made in lecture (i.e. CalculatorBrain, etc.). This is the last

More information

This book contains code samples available under the MIT License, printed below:

This book contains code samples available under the MIT License, printed below: Bluetooth Low Energy in ios Swift by Tony Gaitatzis Copyright 2015 All Rights Reserved All rights reserved. This book or any portion thereof may not be reproduced or used in any manner whatsoever without

More information

Collection Views Hands-On Challenges

Collection Views Hands-On Challenges Collection Views Hands-On Challenges Copyright 2015 Razeware LLC. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed

More information

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net OVERVIEW Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net Microsoft MVP for 4 years C#, WinForms, WPF, Silverlight Joined Cynergy about

More information

ios Development Lecture 3 Controllers of View Controllers Ing. Simone Cirani

ios Development Lecture 3 Controllers of View Controllers Ing. Simone Cirani ios Development Lecture 3 Controllers of View Controllers Ing. Simone Cirani email: simone.cirani@unipr.it http://www.tlc.unipr.it/cirani Corso IFTS Cisita ios Development 2014 Parma Università degli Studi

More information

Building the App - Part 5 - Adding a Link

Building the App - Part 5 - Adding a Link Unit 4 - Coding For Your App Copy and Paste the code below exactly where the tutorials tell you. DO NOT COPY TEXT IN RED. Building the App - Part 5 - Adding a Link XCODE 7 @IBAction func Button1(_ sender:

More information

UI Design and Storyboarding

UI Design and Storyboarding UI Design and Storyboarding Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline Model-View-Controller

More information

CSC 581: Mobile App Development Spring 2018

CSC 581: Mobile App Development Spring 2018 CSC 581: Mobile App Development Spring 2018 Unit 2: Introduciton to the UIKit UIKit, UIViews UIControl subclasses 1 UIKit the UIKit is a code framework for building mobile apps the foundational class for

More information

ITP 342 Mobile App Dev. Web View

ITP 342 Mobile App Dev. Web View ITP 342 Mobile App Dev Web View Web View 2 WebKit The WebKit provides a set of core classes to display web content in windows, and by default, implements features such as following links clicked by the

More information

Lesson 1: Hello ios! 1

Lesson 1: Hello ios! 1 Contents Introduction xxv Lesson 1: Hello ios! 1 ios Developer Essentials 1 A Suitable Mac 1 A Device for Testing 2 Device Differences 2 An ios Developer Account 4 The Official ios SDK 6 The Typical App

More information

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

Stanford CS193p. Developing Applications for ios. Winter CS193p. Winter 2017 Stanford Developing Applications for ios Today Error Handling in Swift try Extensions A simple, powerful, but easily overused code management syntax Protocols Last (but certainly not least important) typing

More information

Duration 5 days (For basic crowd 5+3days needed)

Duration 5 days (For basic crowd 5+3days needed) There's never been a better time to develop for Apple Platforms It is now much easier to develop ios apps than ever with Swift and Xcode. This ios apps development course guides you systematically from

More information

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

lecture 10 UI/UX and Programmatic Design cs : spring 2018 lecture 10 UI/UX and Programmatic Design cs198-001 : spring 2018 1 Announcements custom app progress form due before lab (~1 minute) will be released after lecture only 2 labs left (both very important)

More information

Registering for the Apple Developer Program

Registering for the Apple Developer Program It isn t necessary to be a member of the Apple Developer Program if you don t intend to submit apps to the App Stores, or don t need the cloud-dependent features. We strongly recommend joining, though,

More information

Collection Views. Dr. Sarah Abraham

Collection Views. Dr. Sarah Abraham Collection Views Dr. Sarah Abraham University of Texas at Austin CS329e Fall 2016 What is a Collection View? Presents an ordered set of data items in a flexible layout Subclass of UIScrollView (like UITableView)

More information

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

CSE 438: Mobile Application Development Lab 2: Virtual Pet App CSE 438: Mobile Application Development Lab 2: Virtual Pet App Overview In this lab, you will create an app to take care of your very own virtual pets! The app will only have one screen and simple logic,

More information

ios Development - Xcode IDE

ios Development - Xcode IDE ios Development - Xcode IDE To develop ios applications, you need to have an Apple device like MacBook Pro, Mac Mini, or any Apple device with OS X operating system, and the following Xcode It can be downloaded

More information

Objectives. Submission. Register for an Apple account. Notes on Saving Projects. Xcode Shortcuts. CprE 388 Lab 1: Introduction to Xcode

Objectives. Submission. Register for an Apple account. Notes on Saving Projects. Xcode Shortcuts. CprE 388 Lab 1: Introduction to Xcode Objectives Register for an Apple account Create an application using Xcode Test your application with the iphone simulator Import certificates for development Build your application to the device Expand

More information

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar Design Patterns MSc in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

My First iphone App. 1. Tutorial Overview

My First iphone App. 1. Tutorial Overview My First iphone App 1. Tutorial Overview In this tutorial, you re going to create a very simple application on the iphone or ipod Touch. It has a text field, a label, and a button. You can type your name

More information

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

Stanford CS193p. Developing Applications for ios. Winter CS193p. Winter 2017 Stanford Developing Applications for ios Today Core Data Object-Oriented Database Core Data Database Sometimes you need to store large amounts of data or query it in a sophisticated manner. But we still

More information

Apple Watch Docs. Release 0.1. Michael Hahn

Apple Watch Docs. Release 0.1. Michael Hahn Apple Watch Docs Release 0.1 Michael Hahn Nov 20, 2017 Contents 1 First Watch Glance 3 1.1 Create an iphone App.......................................... 3 1.2 Add WatchKit Targets..........................................

More information

Mobile Computing. Overview. What is ios? 8/26/12. CSE 40814/60814 Fall 2012

Mobile Computing. Overview. What is ios? 8/26/12. CSE 40814/60814 Fall 2012 Mobile Computing CSE 40814/60814 Fall 2012 Overview ios is the opera8ng system that runs iphones, ipod Touches, ipads, and Apple TVs. The language used to develop sogware for ios is Objec8ve- C (very similar

More information

ITP 342 Mobile App Dev. Interface Builder in Xcode

ITP 342 Mobile App Dev. Interface Builder in Xcode ITP 342 Mobile App Dev Interface Builder in Xcode New Project From the Main Menu, select the File à New à Project option For the template, make sure Application is selected under ios on the left-hand side

More information

IPhone Application of Carleton University. Carleton University Computer Science Honors Project Report

IPhone Application of Carleton University. Carleton University Computer Science Honors Project Report IPhone Application of Carleton University Carleton University Computer Science Honors Project Report Student Name: Yang Cai Student Number: 100309906 Project Supervisor: Dr. Dwight Deugo Date: Dec. 13,

More information

Computer Science 251. iphone Application Development. Autorotation, Popover Controllers, Modal Controllers

Computer Science 251. iphone Application Development. Autorotation, Popover Controllers, Modal Controllers Computer Science 251 iphone Application Development Autorotation, Popover Controllers, Modal Controllers Two Types of Orientation Device: physically upside down, rotated left, on its back, etc. Can be

More information

Cocoa Touch Best Practices

Cocoa Touch Best Practices App Frameworks #WWDC15 Cocoa Touch Best Practices Session 231 Luke Hiesterman UIKit Engineer 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Chapter 2 Welcome App

Chapter 2 Welcome App 2.1 Introduction Chapter 2 Welcome App 1. A app is an app that can run on iphones, ipod touches and ipads. a. multi-purpose b. global c. unrestricted d. universal Ans: d. universal 2. You can your apps

More information

Learn to make watchosle

Learn to make watchosle HACKING WITH SWIFT COMPLETE TUTORIAL COURSE Learn to make watchosle P apps with real-worldam S Swift projects REEPaul Hudson F Project 1 NoteDictate 2 www.hackingwithswift.com Setting up In this project

More information

Implementing UI Designs in Interface Builder

Implementing UI Designs in Interface Builder Developer Tools #WWDC15 Implementing UI Designs in Interface Builder Session 407 Kevin Cathey Interface Builder Engineer Tony Ricciardi Interface Builder Engineer 2015 Apple Inc. All rights reserved. Redistribution

More information

Building GUIs with UIKit. Kevin Cathey

Building GUIs with UIKit. Kevin Cathey Building GUIs with UIKit Kevin Cathey Building GUIs with UIKit acm.uiuc.edu/macwarriors/devphone Building GUIs with UIKit What is UIKit? acm.uiuc.edu/macwarriors/devphone Building GUIs with UIKit What

More information

Enhancing your apps for the next dimension of touch

Enhancing your apps for the next dimension of touch App Frameworks #WWDC16 A Peek at 3D Touch Enhancing your apps for the next dimension of touch Session 228 Tyler Fox UIKit Frameworks Engineer Peter Hajas UIKit Frameworks Engineer 2016 Apple Inc. All rights

More information

Hello! ios Development

Hello! ios Development SAMPLE CHAPTER Hello! ios Development by Lou Franco Eitan Mendelowitz Chapter 1 Copyright 2013 Manning Publications Brief contents PART 1 HELLO! IPHONE 1 1 Hello! iphone 3 2 Thinking like an iphone developer

More information

Mastering UIKit on tvos

Mastering UIKit on tvos App Frameworks #WWDC16 Mastering UIKit on tvos Session 210 Justin Voss UIKit Engineer 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from

More information

Mobile Application Programming. Messaging and Delegation

Mobile Application Programming. Messaging and Delegation Mobile Application Programming Messaging and Delegation Color Chooser Color Chooser MFColorChooserView UIControl or UIView MFColorChooserWheelView UIControl MFColorChooserValueSliderView UIControl MFColorChooserAlphaSliderView

More information

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

ios Application Development Lecture 5: Protocols, Extensions,TabBar an Scroll Views ios Application Development Lecture 5: Protocols, Extensions,TabBar an Scroll Views Dr. Simon Völker & Philipp Wacker Media Computing Group RWTH Aachen University Winter Semester 2017/2018 http://hci.rwth-aachen.de/ios

More information

MS_40541 Build Native Cross-Platform Mobile Apps with a Shared C# Business Logic for ios, Android, and UWP in C#.NET with Xamarin and Visual Studio

MS_40541 Build Native Cross-Platform Mobile Apps with a Shared C# Business Logic for ios, Android, and UWP in C#.NET with Xamarin and Visual Studio Build Native Cross-Platform Mobile Apps with a Shared C# Business Logic for ios, Android, and UWP in C#.NET with Xamarin and Visual Studio www.ked.com.mx Av. Revolución No. 374 Col. San Pedro de los Pinos,

More information

My First Cocoa Program

My First Cocoa Program My First Cocoa Program 1. Tutorial Overview In this tutorial, you re going to create a very simple Cocoa application for the Mac. Unlike a line-command program, a Cocoa program uses a graphical window

More information

Organize Your iphone: Icons and Folders

Organize Your iphone: Icons and Folders 227 Chapter 7 Organize Your iphone: Icons and Folders Your new iphone is very customizable. In this chapter we will show you how to move icons around and put your favorite icons just where you want them.

More information

Designing iphone Applications

Designing iphone Applications Designing iphone Applications 4 Two Flavors of Mail 5 Organizing Content 6 Organizing Content 6 Organizing Content 6 Organizing Content 6 Organizing Content Focus on your user s data 6 Organizing Content

More information

View Controller Lifecycle

View Controller Lifecycle View Controller Lifecycle View Controllers have a Lifecycle A sequence of messages is sent to them as they progress through it Why does this matter? You very commonly override these methods to do certain

More information

Adaptive Layout Hands-On Challenges

Adaptive Layout Hands-On Challenges Adaptive Layout Hands-On Challenges Copyright 2015 Razeware LLC. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed

More information

ios 9 SDK Development

ios 9 SDK Development Extracted from: ios 9 SDK Development Creating iphone and ipad Apps with Swift This PDF file contains pages extracted from ios 9 SDK Development, published by the Pragmatic Bookshelf. For more information

More information

AADL Graphical Editor Design

AADL Graphical Editor Design AADL Graphical Editor Design Peter Feiler Software Engineering Institute phf@sei.cmu.edu Introduction An AADL specification is a set of component type and implementation declarations. They are organized

More information

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

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018 User Interfaces Lecture 15 Application Programming on Mac OS Hamza Bennani hamza@hamzabennani.com September 4, 2018 Logistics Office hours: Tue/Thu, 2pm to 3pm. Office: 250 Geoff Wyvill. Acknowledgment:

More information

The MVC Design Pattern

The MVC Design Pattern The MVC Design Pattern The structure of iphone applications is based on the Model-View-Controller (MVC) design pattern because it benefits object-oriented programs in several ways. MVC based programs tend

More information

Assignment III: Graphing Calculator

Assignment III: Graphing Calculator Assignment III: Graphing Calculator Objective The goal of this assignment is to reuse your CalculatorBrain and CalculatorViewController objects to build a Graphing Calculator. By doing this, you will gain

More information

Rx in the real world. 1 Rob Ciolli

Rx in the real world. 1 Rob Ciolli Rx in the real world 1 Rob Ciolli 2 Rob Ciolli 3 Rob Ciolli The App 4 Rob Ciolli Quick architecture overview 5 Rob Ciolli MV - WTF 6 Rob Ciolli Model Simple, immutable data struct returned from DB or APIs

More information