Nucleon and Δ isobar in a strong magnetic field