In fact both of the two are correct. One can have 0 ammonia at any pH, and to that extent the two are unrelated.
However, if there is any ammonia present, how toxic it may be and therefore how much of a worry it might be, is then directly related to pH. I can show 4 ppm of total ammonia (both NH3 and NH4+) in my Altum tank which is at a pH of 6.0 and not be immediately concerned. However, in a rift lake cichlid tank at a pH of 8.5 I would be concerned with a total ammonia reading of just .25 ppm.
If one wants to be technically correct, then by saying ammonia it means NH3 which is normally a gas. In water, it can readily steal H from H2O and that makes ammonium, (NH4+) and hydroxide ions (OH-). And this can work in both directions. What determines how much of total ammonia is in which form in the water depends on the pH.
The bacteria normally consume NH3. So what happens is as they use the NH3 and remove it from the water, some of the remaining ammonium is converting to ammonia to restore the balance. While it is not practical to add ammonia gas to an aquarium, if one could, once in the water it would begin turning into mostly ammonium. Conversely, when one does the normal fishless cycle, we are adding ammonium in some form to the tank. And once it hits the water some of it becomes ammonia.