A suspect has been detained after seven police officers were shot in a residential neighborhood in South Carolina, according to local authorities.