Apple doesn't have an official method for individually locking sensitive apps like Photos with a passcode, but luckily there's a workaround that was introduced with the Screen Time feature that first came out in iOS 12.
If you really want to make sure one of your apps is inaccessible, you can use Apple's App Limits feature to do so. Here's how:
- Open up the Settings app.
- Choose "Screen Time."
- Make sure Screen Time is enabled and a Screen Time passcode is set by choosing the "Use Screen Time Passcode" option
- Tap on App Limits and Tap on the Add Limit option.
- Choose the category that you want. If you want to lock the Photos app, it's in the "Creativity" category.
- Tap on the app that you've picked and then tap Next.
- At the slider where you select the time, choose 1 minute.
- Tap on Add.
- Toggle on "Block at End of Limit."
- If you want to add additional apps, go through the "Add Limit" steps again. Otherwise, exit the Screen Time interface.
When the time limit that you've set expires, you'll be told you've run out of time. You can continue to use the app for one minute, but after that, you'll need to enter your Screen Time passcode to continue to use the app.
There is no way around the passcode, which prevents anyone who has access to your iPhone from opening up and using the app that's been passcode blocked.
How to Use a Locked App
Once you have App Limits in place to lock apps you want to be inaccessible, you can tap on "Ask for More Time" to access the app. You'll need to put in your passcode, and then once you do, you can unlock it for 15 minutes, an hour, or the rest of the day. There's no way to immediately lock it again after approving it for 15 minutes without redoing the entire App Limit setup, so keep that in mind.
You can passcode lock any app on your phone except for the Phone app. There is no option to turn off access to the Phone app at all. For apps like Messages or FaceTime, you need to edit the "Always Allowed" section of Screen Time to remove them for the limit to be enabled.
You can disable access to Messages and FaceTime, but you might not want to. When access to Messages is disabled via App Limits, devices using iCloud for Screen Time are not able to send or receive messages during downtime. You're also not able to see notifications for apps that are locked, so keep that in mind when locking down social networking apps.