Try holding him for a slightly shorter period to see if you can get him back before he wees. He won't want to wee on you, but they need to train their bladder to hold longer - if they're young their bladders are only quite small, and pigs new to a home will also be nervous which also makes them hold less!
Also, having some kind of signal you're about to get him out a minute before you take him out might help - making a specific noise or putting in/ removing something from the cage for example.
Mine usually free-range by day so they can come in and out of their cage to toilet. The only time they can't do this is when I'm cleaning the cage out (there is somewhere else for them to go, but they don't like it as much). Instead of taking the pigs out first, I start lifting out their pigloos etc and as soon as they see me doing that, they know they're going to be kicked out and all three crouch down for a wee! Clever pigs!