iOS has a Chinese Pinyin keyboard built in — no app to download. Add it once in Settings, and it's there whenever you need it.
Open Settings, then go to General → Keyboard → Keyboards.
Tap Add New Keyboard…
Scroll to or search for Chinese, and select Simplified Chinese.
Choose Pinyin - QWERTY (or Pinyin - 10 Key for a phone-style layout).
While typing in any app, press and hold the globe key 🌐 to jump straight to your Chinese keyboard, or tap it repeatedly to cycle through your keyboards.
Type the pinyin for what you want to say — for example nihao — and tap the character you mean, like 你好, from the suggestion bar above the keyboard.
Tip: if you've added several keyboards, holding down the globe key shows a list to pick from directly, rather than cycling through each one with separate taps.