SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Unit 4—Lesson 9:
Building Complex Input Screens
Hotel Manzana
Complex input screens
Data models
Registration
First & last name

Email address

Check-in and check-out dates

Number of adults

Number of children

Wi-Fi (per day)

Room type
Room Type
ID

Name

Short name

Price
Data models
struct Registration {
var firstName: String
var lastName: String
var emailAddress: String
var checkInDate: Date
var checkOutDate: Date
var numberOfAdults: Int
var numberOfChildren: Int
var roomType: RoomType
var wifi: Bool
}
struct RoomType: Equatable {
var id: Int
var name: String
var shortName: String
var price: Int
//Equatable Protocol Implementation for RoomType
static func == (lhs: RoomType, rhs: RoomType) -> Bool {
return lhs.id == rhs.id
}
}
Style dateStyle timeStyle
.none
.short 11/23/37 3:30 PM
.medium Nov 23. 1937 3:30:32 PM
.long November 23, 1937 3:30:32 PM PST
.full Tuesday, April 12, 1952 AD 3:30:42 PM Pacific Standard Time
Date style
Converting dates to strings
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
Converting dates to strings
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
checkInDateLabel.text = dateFormatter.string(from: checkInDatePicker.date)
UIDatePicker and datePickerMode
Date picker
Countdown timer

.countDownTimer
Date and time

.dateAndTime
Time

.time
Date

.date
Parameters
Date picker
minimumDate and maximumDate

• Minimum date must be earlier than maximum date

minuteInterval

• For minute wheel, if displayed

• Must be evenly dividable into 60
tableView(_:heightForRowAt:)
Adjusting cell heights
override func tableView(_ tableView: UITableView, 

heightForRowAt indexPath: IndexPath) -> CGFloat
Allows the delegate to specify rows with varying heights
Use indexPath to determine the row in tableView
Returned value overrides the value specified for the rowHeight property of
UITableView for the given row
override func tableView(_ tableView: UITableView, 

heightForRowAt indexPath: IndexPath) -> CGFloat {
switch (indexPath.section, indexPath.row) {
case (datePickerCellIndexPath.section, datePickerCellIndexPath.row):
if isDatePickerShown {
return 216.0
} else {
return 0.0
}
default:
return 44.0
}
}
Complex Input Screens
Unit 4—Lesson 9
Learn how to incorporate these system view controllers for displaying alerts,
sharing content, sending messages, and accessing the camera and photo library
on an iOS device.
Lab: Employee Roster
Unit 4—Lesson 9
Create a screen that accepts complex user input to build an employee roster that keeps
track of employee information
© 2017 Apple Inc. 

This work is licensed by Apple Inc. under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.

Weitere ähnliche Inhalte

Was ist angesagt?

Assignment3
Assignment3Assignment3
Assignment3
Mahmoud
 
Function recap
Function recapFunction recap
Function recap
alish sha
 

Was ist angesagt? (11)

Function BPK2
Function BPK2Function BPK2
Function BPK2
 
Assignment3
Assignment3Assignment3
Assignment3
 
Type-level programming
Type-level programmingType-level programming
Type-level programming
 
6nullables in c#
6nullables in c#6nullables in c#
6nullables in c#
 
Function recap
Function recapFunction recap
Function recap
 
Akshay Sharma , BCA Third Year
Akshay Sharma , BCA Third YearAkshay Sharma , BCA Third Year
Akshay Sharma , BCA Third Year
 
COW
COWCOW
COW
 
Data Visualization With R: Learn To Modify Font Of Graphical Parameters
Data Visualization With R: Learn To Modify Font Of Graphical ParametersData Visualization With R: Learn To Modify Font Of Graphical Parameters
Data Visualization With R: Learn To Modify Font Of Graphical Parameters
 
R Data Visualization: Learn To Add Text Annotations To Plots
R Data Visualization: Learn To Add Text Annotations To PlotsR Data Visualization: Learn To Add Text Annotations To Plots
R Data Visualization: Learn To Add Text Annotations To Plots
 
String searching
String searchingString searching
String searching
 
Function presentation
Function presentationFunction presentation
Function presentation
 

Ähnlich wie Building complex input screens

I need help for my next project due next tuesday can you help me in .pdf
I need help for my next project due next tuesday can you help me in .pdfI need help for my next project due next tuesday can you help me in .pdf
I need help for my next project due next tuesday can you help me in .pdf
amritashinfosalys
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
mwillmer
 
Dotnet unit 4
Dotnet unit 4Dotnet unit 4
Dotnet unit 4
007laksh
 
Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimized
Woody Pewitt
 

Ähnlich wie Building complex input screens (20)

R Tanenbaum .Net Portfolio
R Tanenbaum .Net PortfolioR Tanenbaum .Net Portfolio
R Tanenbaum .Net Portfolio
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
DITEC - Programming with C#.NET
DITEC - Programming with C#.NETDITEC - Programming with C#.NET
DITEC - Programming with C#.NET
 
I need help for my next project due next tuesday can you help me in .pdf
I need help for my next project due next tuesday can you help me in .pdfI need help for my next project due next tuesday can you help me in .pdf
I need help for my next project due next tuesday can you help me in .pdf
 
Cocoa heads 09112017
Cocoa heads 09112017Cocoa heads 09112017
Cocoa heads 09112017
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Scalding Big (Ad)ta
Scalding Big (Ad)taScalding Big (Ad)ta
Scalding Big (Ad)ta
 
Patterns and practices for real-world event-driven microservices by Rachel Re...
Patterns and practices for real-world event-driven microservices by Rachel Re...Patterns and practices for real-world event-driven microservices by Rachel Re...
Patterns and practices for real-world event-driven microservices by Rachel Re...
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
 
DIWE - Advanced PHP Concepts
DIWE - Advanced PHP ConceptsDIWE - Advanced PHP Concepts
DIWE - Advanced PHP Concepts
 
Bc0037
Bc0037Bc0037
Bc0037
 
Dotnet unit 4
Dotnet unit 4Dotnet unit 4
Dotnet unit 4
 
Hexagonal architecture
Hexagonal architectureHexagonal architecture
Hexagonal architecture
 
Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimized
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
 
C# basics
C# basicsC# basics
C# basics
 
1204csharp
1204csharp1204csharp
1204csharp
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.ppt
 
Addressing Scenario
Addressing ScenarioAddressing Scenario
Addressing Scenario
 

Mehr von SV.CO (20)

Handout level-1-module-1
Handout   level-1-module-1Handout   level-1-module-1
Handout level-1-module-1
 
Persistence And Documents
Persistence And DocumentsPersistence And Documents
Persistence And Documents
 
Working with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONWorking with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSON
 
Saving Data
Saving DataSaving Data
Saving Data
 
Alerts notification
Alerts notificationAlerts notification
Alerts notification
 
UI Dynamics
UI DynamicsUI Dynamics
UI Dynamics
 
Practical animation
Practical animationPractical animation
Practical animation
 
Segues and navigation controllers
Segues and navigation controllersSegues and navigation controllers
Segues and navigation controllers
 
Camera And Email
Camera And EmailCamera And Email
Camera And Email
 
Scroll views
Scroll viewsScroll views
Scroll views
 
Intermediate table views
Intermediate table viewsIntermediate table views
Intermediate table views
 
Table views
Table viewsTable views
Table views
 
Closures
ClosuresClosures
Closures
 
Protocols
ProtocolsProtocols
Protocols
 
App anatomy and life cycle
App anatomy and life cycleApp anatomy and life cycle
App anatomy and life cycle
 
Extensions
ExtensionsExtensions
Extensions
 
Gestures
GesturesGestures
Gestures
 
View controller life cycle
View controller life cycleView controller life cycle
View controller life cycle
 
Controls in action
Controls in actionControls in action
Controls in action
 
Auto layout and stack views
Auto layout and stack viewsAuto layout and stack views
Auto layout and stack views
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

Building complex input screens

  • 1. Unit 4—Lesson 9: Building Complex Input Screens
  • 3. Data models Registration First & last name Email address Check-in and check-out dates Number of adults Number of children Wi-Fi (per day) Room type Room Type ID Name Short name Price
  • 4. Data models struct Registration { var firstName: String var lastName: String var emailAddress: String var checkInDate: Date var checkOutDate: Date var numberOfAdults: Int var numberOfChildren: Int var roomType: RoomType var wifi: Bool } struct RoomType: Equatable { var id: Int var name: String var shortName: String var price: Int //Equatable Protocol Implementation for RoomType static func == (lhs: RoomType, rhs: RoomType) -> Bool { return lhs.id == rhs.id } }
  • 5. Style dateStyle timeStyle .none .short 11/23/37 3:30 PM .medium Nov 23. 1937 3:30:32 PM .long November 23, 1937 3:30:32 PM PST .full Tuesday, April 12, 1952 AD 3:30:42 PM Pacific Standard Time Date style Converting dates to strings let dateFormatter = DateFormatter() dateFormatter.dateStyle = .medium
  • 6. Converting dates to strings let dateFormatter = DateFormatter() dateFormatter.dateStyle = .medium checkInDateLabel.text = dateFormatter.string(from: checkInDatePicker.date)
  • 7. UIDatePicker and datePickerMode Date picker Countdown timer .countDownTimer Date and time .dateAndTime Time .time Date .date
  • 8. Parameters Date picker minimumDate and maximumDate • Minimum date must be earlier than maximum date minuteInterval • For minute wheel, if displayed • Must be evenly dividable into 60
  • 9. tableView(_:heightForRowAt:) Adjusting cell heights override func tableView(_ tableView: UITableView, 
 heightForRowAt indexPath: IndexPath) -> CGFloat Allows the delegate to specify rows with varying heights Use indexPath to determine the row in tableView Returned value overrides the value specified for the rowHeight property of UITableView for the given row
  • 10. override func tableView(_ tableView: UITableView, 
 heightForRowAt indexPath: IndexPath) -> CGFloat { switch (indexPath.section, indexPath.row) { case (datePickerCellIndexPath.section, datePickerCellIndexPath.row): if isDatePickerShown { return 216.0 } else { return 0.0 } default: return 44.0 } }
  • 11. Complex Input Screens Unit 4—Lesson 9 Learn how to incorporate these system view controllers for displaying alerts, sharing content, sending messages, and accessing the camera and photo library on an iOS device.
  • 12. Lab: Employee Roster Unit 4—Lesson 9 Create a screen that accepts complex user input to build an employee roster that keeps track of employee information
  • 13. © 2017 Apple Inc. This work is licensed by Apple Inc. under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.