Does iOS encrypt all the data on my device when I set a passcode to my iPhone
Yes, your iOS passcode will encrypt your phone's data.


  Data protection enhances the built-in hardware encryption by protecting the hardware encryption keys with your passcode.


Source: iOS: Understanding data protection

Whilst it was generally unclear exactly what was encrypted in older versions of iOS, Apple have made it clear in their new privacy policy with regard to iOS 8:


  On devices running iOS 8, your personal data such as photos, messages (including attachments), email, contacts, call history, iTunes content, notes, and reminders is placed under the protection of your passcode.


Source: https://www.apple.com/uk/privacy/government-information-requests/