The electronic and optical properties of zincblende nanowires are investigated in the presence of a uniform magnetic field directed along the [001] growth direction within the k · p method. We focus our numerical study on core-shell nanowires consisting of the III-V materials GaAs, Al(x)Ga(1-x)As and (Al(y)Ga(1-y))₀.₅₁In₀.₄₉P. Nanowires with electrons confined in the core exhibit a Fock-Darwin-like spectrum, whereas nanowires with electrons confined in the shell show Aharonov-Bohm oscillations. Thus, by properly choosing the core and the shell materials of the nanowire, the optical properties in a magnetic field can be tuned in very different ways.