Among the buttons in your iPhone's Control Center -- an overlay that appears when you swipe up from the bottom edge -- is one to lock the screen in portrait orientation. Locking the screen in landscape orientation is harder, and requires using one of the iPhone's accessibility features as a workaround.
Portrait Orientation Lock
Video of the Day
Step 1
Swipe upwards from the bottom of the screen to display the control center.
Video of the Day
Step 2
Tap the Portrait Orientation Lock button.
Step 3
Tap outside of the control center to hide it.
Landscape Orientation Lock
Locking the screen in landscape orientation requires the screen to be already locked in portrait orientation, and relies on the iPhone's Assistive Touch function. The process works only when the screen can display its contents in landscape orientation -- for example, you can do it within the iPhone's Safari browser, but not on the Home screen. If you switch from an app that supports landscape orientation to one that doesn't, or return to the Home screen, the "lock" is lost and must be reapplied.
Enabling Assistive Touch
Step 1
Ensure the iPhone's screen is locked in portrait orientation. Open the Settings app and tap General.
Step 2
Tap Accessibility.
Step 3
Tap AssistiveTouch. You may have to scroll down for this option to be visible.
Step 4
Tap the AssistiveTouch switch to enable it.
Rotating the Screen
Step 1
Open the app you want to use and tap the Assistive Touch overlay.
Step 2
Tap Device.
Step 3
Tap Rotate Screen.
Step 4
Tap either Left or Right, depending on how you want to hold the iPhone in landscape orientation. If you want the Home button under your right thumb, tap Left; otherwise, tap Right.
Step 5
Tap anywhere outside the overlay to minimize it and return to the app.