Photoionization and the formation of dwarf galaxies