UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

(SOLVED)Project 1/Final Tweaks Bug: Back label on Detail screen sometimes "Storm Viewer," sometimes "Back"

Forums > 100 Days of Swift

After completing the Final Tweaks portion of the project, on the Detail screen, the label to the left of the image title sometimes appears as "< Back" and sometimes shows as "< Storm Viewer." It's reproducible and consistent - all images show "< Back" except for nssl0091.jpg, nssl0051.jpg and nssl0041.jpg.

3      

It's not a bug. It looks like a feature of how the label pointing back to the previous screen works so I think this issue is solved.

Here's why I've concluded this. Changed the variable title in ViewController to "Storm" instead of "Storm Viewer" - result was that back label on the Detail screen showed "< Storm" for every single image.

Next, I changed title to "Storm Viewer XXX." This time, every single back label on the Detail screen showed "< Back."

Finally, I set the title back to "Storm Viewer" but changed the files names to ns1.jpg, ns2.jpg, ns3.jpg, ... This time, "< Storm Viewer" appeared as the back label for every image.

Given this, the behavior of the back label is that it will display the value of the title variable in ViewController as long as the amount of horizontal space it consumes does not cross over into the space allocated for the screen title. When it does cross over the threshold, the title variable is ignored and the shorter "< Back" label is used in its place.

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.