When a photon interacts with an atom, three things can happen:
elastic scattering, the photon keeps its energy and phase and changes angle
inelastic scattering, the photon gives part of its energy to the atom, and changes angle
absorption, the photon gives all its energy to the atom and the absorbing electron moves to a higher energy level as per QM
In the case of the detector, it is absorption. The photon seizes to exist. It transforms into the kinetic energy of the electron.
In the case of air, the air's atoms scatter the photons elastically. It is Rayleigh scattering, that is why the sky is blue. In this case, the wavelength of the photons is much bigger then the scattering atoms. This is the only way that the energy and phase of the photons is kept, and you can see images of objects through air without bigger distortions. It is a coherent (specular) way of refraction. In optics, we use the expressions coherent and diffuse (decoherent) for reflection and refraction. In the case of refraction, like through air, this (coherent) means that that not only is the energy and phase of the individual photons kept, but the relative phases of the photons' too. This is the only way that the image we see through air keeps coherent.
Now you edited your question to talk about the detector in front of the slits. That is called the which way experiment. In that case, there is a detector in front of one of the slits. That is inelastic scattering, and that will cause that photon not to create an interference pattern.
So basically when the photon is elastically scattered through air, it will still create an interference pattern, because in elastic scattering, the energy and phase is kept.
When there is a detector in front of the slit, that is inelastic scattering, and in that case that photon does not create an interference pattern, because the photon gives part of its energy to the scattering atom, and changes phase.