Driving is the best way to see Costa Brava
Driving around in a rental car is the easiest and most practical way to see the best parts of Costa Brava. You can get a lot out of the region when you are on your own schedule.
Public transport is possible, but not easy
I do not recommend to use public transport to travel between Costa Brava towns. It is not impossible with public transport you need to plan well and be patient with the infrequent services.
There are bus services to connect the towns of Costa Brava region, but unlike in Andalusia for example, their schedules and routes are not designed for quick, point to point travel. And trains only connect the big Costa Brava towns.
Expect a limited itinerary using buses and trains
So with public transport, you will need a longer trip or a limiting itinerary based on ease of transport. Unless you travel by car you should be prepared to miss out the less touristy parts that are off the main roads. Even larger places like Cadaques, Pals, Figueres, and Begur, are not served very well by public transport. You will also find it difficult to visit Empuriabrava for the Greek and Roman ruins.
Where to stay if you decide to use public transport:
Option 1 - Girona
Base yourself in Girona. Barcelona has many buses and trains connecting to Girona, and many flights from the UK land at Girona-Costa Brava airport. Girona, in turn, is relatively well connected to other Costa Brava towns. Making Girona your base allows you to visit many coastal towns as day trips by public transport.
Option 2 - Calella de Palafrugell
Base yourself on the coast in Calella de Palafrugell. First, take a train or bus from Barcelona to Palafrugell, the inland town with the same name as the coastal town. Then take a taxi ride to Calella de Palafrugell (on the coast) to make your base. This way much of the beautiful coast of the area - Llafranc, Tamariu, Cap Roig - can be walked or hiked, with a mix of local taxis as required.
If you are doing a short trip - anything less than 4 days in Costa Brava - you are far better off getting a rental car.