The pH-controllable molecular rotaxanes based on dialkylammonium ions have been proven to be useful materials in different fields. By modifying the dialkylammonium ion to a new recognition motif after the assembly of the rotaxanes, new molecular switches with versatile function may be developed with ease.