To input Chinese characters, you need to add a Chinese keyboard in your iPhone's settings. You can do this by going to:
Settings > General > Keyboards > Add New Keyboard.
And for pinyin, after you switch to a Chinese keyboard, press and hold on a vowel to see all 4 tones, as shown below:
There is also keyboard for "handwriting" that will let you write the Chinese characters.