Rooftop venues in Barcelona normally come in the form of swanky hotel bars, not of all of which serve proper meals, but which you can usually visit for drinks and snacks if you aren’t staying at the hotel and take in the view before going for dinner.
Not sure if this is the kind of view you were after, but if you want a good meal in a picturesque setting, I’d recommend the beachside restaurant Bestial (www.grupotragaluz.com). Book ahead to get a seat outside on the terrace-garden (or wait for a table in the stylish outdoor bar and drink cocktails), where you get a good view of the shoreline. It’s prettier than most of the beachside places, and the greenery on the terrace is a nice touch. The food is mainly Italian – you can get pizzas, pasta and rice dishes, as well as meat and seafood. It’s quite pricey if you go for the meat/seafood, but the food is worth it.