To set a passcode: From the home screen, choose Settings > General > Passcode Lock and enter a 4-digit passcode, then enter the passcode again to verify it. iPhone then requires you to enter the passcode to unlock it or to display the passcode lock settings. NOTE: If you forget your passcode, you must restore the iPhone software.
Set how long before your passcode is required: Choose General > Passcode Lock and enter your passcode. Tap Require Passcode, and then select how long iPhone can be idle before you need to enter a passcode to unlock it.
To erase data after ten failed passcode attempts: Choose General > Passcode Lock, enter your passcode, and tap Erase Data to turn it on. After ten failed passcode attempts, your settings are reset to their defaults and all your information and media on your iPhone is removed by overwriting the data stored on iPhone. NOTE: You can't use iPhone while data is being overwritten. This can take one to two hours or more, depending on the storage capacity of your iPhone.
To turn the passcode lock off: From the home screen, choose Settings > General > Passcode Lock, enter your passcode, and tap Turn Passcode Off, then enter your passcode again.
To change the passcode: From the home screen, choose Settings > General > Passcode Lock, enter your passcode, and tap Change Passcode. Enter your passcode again, then enter and reenter your new passcode.
SMS Preview: By default, iPhone displays a preview of new text messages when iPhone is locked or you are using another application. You can turn this preview on or off in Settings: Choose General > Passcode Lock and tap Show SMS Preview.