South Africa's local elections have delivered a sharp setback to the African National Congress (ANC), as partial results showed falling support for the party that ended apartheid.