One of the more interesting parts of being in another country (or even a different part of the same country) is that the culture of that area is going to be different then what your used to.
People may have a "thing" for being touched, or not. Some areas of the world touching is taboo, others, it's normal and even polite.
The same is true for photos, talking, gathering, pointing, giggling, etc.
It can be annoying at times. But it's the way things work in the area you're in.
In the OP you mention that your traveling companions are black and that they get upset by the locals "singling" them out. Why? That's the real question. Why are they getting upset? Yes, if they were in the US and singled out like that they would have a legitimate gripe. But you're not in the US. In China, touching is more acceptable then it is here. As is taking "un-requested" photos. As to making conversation, again, very normal there. Not so sure about the hair thing, but that's probably a part of touching.
Ever walk up to a random girl, touch her hair, and tell her you like how smooth it is? Of course not. That's not acceptable behavior here in the US. In fact that's likely to get you arrested. But that's not true in all parts of the world.
Your friends are not being singled out due to racism or prejudice. They are drawing attention because they are different in a culture that celebrates conformity.
My suggestion to you, and your friends, is to leave early to get where you want. Embrace the local customs, even if it's outside your comfort zone. And be just as talkative and "touchy" back with them. If they feel your hair, feel theirs back.
Chinese people touch each other for different reasons then we do. Some don't like it, and some don't mind. But if they're touching your hair, then it's probably ok to touch theirs. And if not, I suppose they will stop.
The point is, you're in a different country, with a different culture. Trying to force the Chinese to conform to the US social customs and etiquette is far more insulting then what the people are doing to you and your friends.