Electronic spectroscopy of cold ions in a radio-frequency trap