I have an iPhone 4 kicking around that I use with my children so they can contact me when they are away from home. It worked perfectly until recently, when the power button broke. The biggest drawback to a broken power button is that you can no longer turn off the screen to put the phone to sleep or power off the device to conserve the battery.
After a few weeks of accidental butt dials and dead batteries, I stumbled upon this posting at GrownUpGeek by Randy Brown. It turns out that you can lock an iPhone or power it off without touching the power button when you enable AssistiveTouch in the Accessibility options.
- Open Settings > General > Accessibility.
- Scroll down to AssistiveTouch and tap AssistiveTouch and tap the toggle to turn it ON. The toggle will be green when the feature is enabled in iOS 7.
- A small dark square with a white circle in the middle should now appear at the edge your screen. You can drag this square icon to a convenient location on your screen.
- Tap the circle icon to open the AssistiveTouch menu and then tap "Device" to access the device-specific commands as shown in the image at the top of the page.
- You will see an icon for "Lock Screen" as shown in the image at the top of the page. Tap this once if you want to lock the screen of your iPhone. Tap and hold if you want to activate the iPhone's power-off slider.
Now that your iPhone is sleep mode, just tap the home button to wake it up. If you turned off your iPhone using the power-off slider button, you will need to plug in the device using your charging cable in order to power it back on.