Ioannis Pavlidis Dinesh Majeti Ashik Khatri

Slides:



Advertisements
Similar presentations
Mobile Development Introduction to Visual Studio Development Rob Miles Department of Computer Science.
Advertisements

OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
Table Lens Introduction to the Table Lens concept Table Lens Implementation Projected Usage Scenarios Usage Comparison with Splus Critical Analysis.
More OOP Design Patterns
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Session 7 JavaScript/Jscript: Arrays Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
Tuc Goodwin  Object and Component-Oriented Programming  Classes in C#  Scope and Accessibility  Methods and Properties  Nested.
Microsoft Access 2007 Tutorial (Part II) CIS*1000*DE.
Lecture Set 9 Arrays, Collections and Repetition Part C - Random Numbers Rectangular and Jagged arrays.
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.
Course Summary Xcode & iPhone Simulator
COSC 4355/6355 Intro to Ubiquitous Computing Dr. Ioannis Pavlidis Dinesh Majeti & Ashik Khatri.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 7B PROBABILITY DISTRIBUTIONS FOR RANDOM VARIABLES ( POISSON DISTRIBUTION)
1 SWIFT 2.0: New features Dzianis Astravukh AUGUST 5, 2015.
Review of Previous Class Declaring variables var myVariableName:DataType = variableValue;
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
MTA EXAM HTML5 Application Development Fundamentals.
DB Implementation: MS Access Forms. MS Access Forms: Purpose Data entry, editing, & viewing data in Tables Forms are user-friendlier to end-users than.
CSIS 123A Lecture 1 Intro To Classes Glenn Stevenson CSIS 113A MSJC.
Course Summary Xcode & iPhone Simulator
Building Web Applications with Microsoft ASP
CompSci 230 S Programming Techniques
Lecture 1 - Intro to Swift
Java FX: Scene Builder.
Creating and Using Objects, Exceptions, Strings
Creating Oracle Business Intelligence Interactive Dashboards
Programming & Scratch.
Lec 5: SNMP Network Management
DATABASE CONCEPTS A database is a collection of logically related data designed to meet the information needs of one or more users Data bases are store-houses.
Classes and OOP.
Android – Event Handling
Module 5: Common Type System
CSC420 Page Layout.
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
JavaScript: Functions.
C# Programming Arrays in C# Declaring Arrays of Different Types Initializing Array Accessing Array Elements Creating User Interfaces Using Windows Standards.
Anatomy of a Class & Method
Introduction to Events
Overview of Hadoop MapReduce MapReduce is a soft work framework for easily writing applications which process vast amounts of.
Chap 7. Building Java Graphical User Interfaces
EEC-492/693/793 iPhone Application Development
DB Implementation: MS Access Forms
Graphical User Interfaces -- Introduction
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
The structure of Interactive Software
6 Delegate and Lambda Expressions
What is a Database? A collection of data organized in a manner that allows access, retrieval, and use of that data.
CSC 581: Mobile App Development
DB Implementation: MS Access Forms
JavaScript Arrays.
Ioannis Pavlidis Dinesh Majeti Ashik Khatri
Lecture Set 10 Windows Controls and Forms
Introduction to Database Programs
Calendar like the Periodic Table
Chapter 1 Databases and Database Objects: An Introduction
Database Design Hacettepe University
Introduction to Data Structure
Lessons Vocabulary Access 2016.
Introduction to Database Programs
5. 3 Coding with Denotations
Analyzing Data Using Access
Data Structures and ADTs
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Assignment resource Working with Excel Tables, PivotTables, and Pivot Charts Fairhurst pp The commands on these slides work with the Week 2 Excel.
C# Language & .NET Platform 12th Lecture
Creating and Using Classes
Presentation transcript:

Ioannis Pavlidis Dinesh Majeti Ashik Khatri Lecture 3 Ioannis Pavlidis Dinesh Majeti Ashik Khatri

Overview Protocols Delegates UIStackView

Protocols Specifies a list of methods like a “contract” or “interface” A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality Any type that satisfies the requirements of a protocol is said to conform to that protocol Protocols can be made optional using @objc and optional keywords

Protocols Defined similar to classes, structures, and enumerations Property requirements are declared as variable properties protocol SomeProtocol { func doSomething() var mustBeSettable: Int { get set } var doesNotNeedToBeSettable: Int { get } } @objc protocol SomeProtocol { optional func doSomething()

Implementing a protocol protocol RandomNumberGenerator { func random() -> Double } class SomeClass: RandomNumberGenerator { var lastRandom = 42.0 let m = 139968.0 let a = 3877.0 let c = 29573.0 func random() -> Double { lastRandom = ((lastRandom * a + c) % m) return lastRandom / m }

Delegation Enables a class or structure to hand off (or delegate) some of its responsibilities to an instance of another type. Can be used to respond to a particular action Retrieve data from an external source without needing to know the underlying type of that source.

Example Start with a simple protocol protocol UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool }

Protocol as a Type class UITextField { var delegate: UITextFieldDelegate? var text: String? //… some other stuff }

Delegating responsibility class Controller: UITextFieldDelegate { var textField = UITextField() textField.delegate = self func textFieldShouldReturn() -> Bool { // do something when text field returns. }

Delegates everywhere UITableView Example: When a table row is tapped, when a table view cell is displayed, etc. UITextField Example: Notifying when the user stops typing, hits the return key, etc Classes like UITableView, UITextField, do not provide implementation details for certain events. These are delegated off to any class that conforms to the protocols

UIStackView Provides a streamlined interface for laying out a collection of views in either a column or a row Creating user interfaces that can dynamically adapt to the device’s orientation, screen size, and any changes in the available space Uses AutoLayout to position and size its arranged views Stack views can be nested

UIStackView Manages layout of all the views in its arrangedSubviews property Arranged along the stack view axis, based on their order in the arrangedSubviews array The exact layout varies depending on the stack view’s properties like axis, distribution, alignment, spacing

References Protocols and Delegates UIStackView Tutorial More on UIStackView