We investigate the dynamic nuclear polarization from the hyperfine interaction between nonequilibrium electronic spins and nuclear spins coupled to them in semiconductor nanostructures. We derive the time and position dependence of the induced nuclear spin polarization and dipolar magnetic fields. In GaAs/AlGaAs parabolic quantum wells the nuclear spin polarization can be as high as 80% and the induced nuclear magnetic fields can approach a few gauss with an associated nuclear resonance shift of the order of kHz when the electronic system is 100% spin polarized. These fields and shifts can be tuned using small electric fields. We discuss the implications of such control for optical nuclear magnetic resonance experiments in low-dimensional semiconductor nanostructures.