From the course: Programming for Non-programmers: iOS 17 and Swift 5
Unlock this course with a free trial
Join today to access over 23,400 courses taught by industry experts.
Replacing the mode buttons with symbols
From the course: Programming for Non-programmers: iOS 17 and Swift 5
Replacing the mode buttons with symbols
- [Presenter] Now let's take a look at taking these buttons over on the right and swapping them out for symbols so we can use images inside of our buttons. What we're basically going to do is copy our CalculatorButton and we'll call it CalculatorImageButton, and in there, we're just going to accept an image instead of text. So let's press command+N on the keyboard, I'll create a new Swift UI view by pressing return because it's already selected, and we'll call this CalculatorImageButton just like that. Hit return or create and there it is. I'm going to go over to CalculatorButton and I'm going to copy everything inside of the view. So line 11 through 27, I'm going to copy that. Go over to CalculatorImageButton, and then I'm going to paste it in. For the action on line 14, I'll need to change that to "CalculatorImageButton". And then I'm going to replace "text" with "image", and just before buttonText, I'm going to type "systemName", and then a colon just like that, and then change the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Inhalt
-
-
-
-
-
-
-
-
(Locked)
Storing the saved number5m 38s
-
(Locked)
Showing the total when the equals button is tapped3m 40s
-
(Locked)
Formatting the total number3m 3s
-
(Locked)
Replacing the mode buttons with symbols2m 50s
-
(Locked)
Adding an app icon1m 20s
-
(Locked)
Challenge: Clear button32s
-
(Locked)
Solution: Clear button1m 40s
-
(Locked)
-