IC 4214 is a weakly barred galaxy, the observed velocity field of which has been well modelled by a dynamical simulation. We take the velocity field from this simulation as being representative of that to be found in a class of barred spiral galaxies, and use it as input into a galactic dynamo model. The strong non-circular velocities are found to play an important role in determining the morphology of the magnetic field. The most conspicuous features are marked magnetic `arms', steady in the frame corotating with the bar, and trailing from near the ends of the bar. They are generated by a mechanism associated with the corotation resonance. Near the centre of the galaxy, the magnetic field is approximately axisymmetric. The computed magnetic field structure has features similar to those of the fields observed in barred galaxies.