It's fairly easy, once you figure it out. Basically you just exploit the cooldown of Jayce's R. Irelia is great because she can initiate at almost any time.
Thus
Trick 1- start freefarming til Jayce tries to jump you. If you can stun him, great. If you have to back off, fine. If he jumps you, W, E, run. You might not exchange profitably BUT
Inevitably he will push you to tower and change to his cannon
Trick 2- when Jayce takes a power shot at you, just charge him. Often he will miss expecting you to try to dodge. Better yet, right when he changes, Q a creep and then just smack him.
Trick 3- Don't go in to kill, because if you end up chasing him, that's when he switches back to hammer, gains movement speed, gains a critical hit, and smacks you around the map. If you CAN pick up a kill great but try to push him out of lane
The last trick for doing that is also simple. Just build health and mana regen and continue to buy pots.
Hilta basically has the right idea. Just avoid large confrontations and even if you don't trade profitably, buy a regrowth pendant and maybe a philosopher's stone if you are running out of mana against him. Let him push, then when he switches to cannon charge him, and you will come out on top. Just don't chase. Charge him, dish it out, then run back. He will switch to hammer and have no one to hit.