Question
LAB 4 Hello World (Max Grade 110pts) The following lab is intended to exercise your skills and understanding of labels, text fields, buttons and basic
LAB 4 Hello World (Max Grade 110pts)
The following lab is intended to exercise your skills and understanding of labels, text fields, buttons and basic connection of UI to code.
Create a new iOS project named HelloWorld(20 pts) Create two Labels
headLabel label that at the very top that displays your NAME
greetingLabel label under headLabel that is blank to start
(20 pts) Create a Text Field
nameTextField a text field that that is positioned under both labels and has placeholder text of Enter your name
(20 pts) Create two side by side Buttons
helloButton this will be the left button and it will read Say Hello
goodbyeButton this will be the right button and it will read Say Goodbye
(40 pts) Handle the button press
Validate the text field input, if theres no text in it write to the greetingLabel the message Please input your name below
If the helloButton is pressed, capture the name of the person from the text field and write Hello, [name] in the greetingLabel
If the goodbyeButton is pressed, write Goodbye, [name] in the greetingLabel
Extra Credit (10pts) Add a 3rd Label: timeStampLabel and display the current time in it every time the button is pressed assuming that there is a name in the text field HINT: use the Date() object.
Example output:
Max Smith
Hello, Max Smith
2:55 pm (you will need to do some formatting to get it to look like this)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started