As long as your iPhone is running iOS 14.5 or higher, you have access to a Shortcuts action called “Set Orientation Lock.” Using this action, you can create a shortcut automation that will enable or disable the portrait orientation lock.

RELATED: How to Lock Your iPhone or iPad’s Screen Orientation

The Automation feature in Shortcuts supports many triggers, ranging from the time of day to opening or closing apps. In this guide, we’ll focus on the opening and closing app trigger.

When using the Orientation Lock action in a shortcut, you can create multiple automations depending on your needs. For example, you can disable the orientation lock when opening Netflix or YouTube. Then, you can create another one for reenabling it when closing the Netflix or YouTube app.

In the following guide, we’ll walk you through the process of setting up an automation that disables orientation lock when you open an app (Netflix or YouTube).

To get started, first, open the “Shortcuts” app on your iPhone and navigate to the “Automations” tab.

Tap the “+” button from the top.

Choose the “Create Personal Automation” option.

Now, from the triggers list, tap the “App” option.

Here, tap the “Choose” button from the “App” section.

Search for and add the app that you want to create the automation for. You can choose multiple apps here as well. Tap “Done” to save your selection.

Make sure that the “Is Opened” option is selected. This makes sure that the automation runs when you open the selected apps. Then, tap the “Next” button from the top.

It’s time to create the shortcut. Here, tap the “Add Action” button.

Search for and add the “Set Orientation Lock” action.

By default, this action is set to toggle the orientation lock. But we want to disable it, so tap the “Toggle” button for more options.

From the pop-up, choose the “Turn” option.

Next, tap the “On” button so that it switches to the “Off” settings. The shortcut is now complete. Tap the “Next” button.

By default, the shortcut automation will send you a notification that you’ll have to tap to trigger the automation. Toggle off the “Ask Before Running” option to disable this feature.

From the pop-up, tap the “Don’t Ask” button to confirm.

Now, this automation will run automatically in the background. Once you’re done, tap the “Done” button.

And that’s it. The automation is now complete.

The next time you open the Netflix or YouTube app, you’ll see a notification saying that the app has triggered the shortcut.

Now that you’ve created the automation for disabling the portrait orientation lock when opening an app, you can create another automation to reenable it when you close the apps. You can repeat the instructions above with a few modifications.

When you’re setting up the shortcut, make sure to select the “Is Closed” option.

And in the shortcut action, set the orientation to “Turn On.”

You don’t have to spend time creating complex shortcuts to automate actions on your iPhone or iPad. You can just download community-created shortcuts and start using them in just a second!

RELATED: How to Find and Install Third-Party Shortcuts on iPhone and iPad