I've found that you've got to be near remission (3 bms a day or less, at least semi solid) in order to regain weight. I'd eat tons of extra calories and yet only regain a half a pound a week when having 3 bms a day. It takes time, patience, lots of calories, and a series of months to regain the weight lost during your flare. If you're in a remission then regaining weight is quite easy. It's just simmering inflammation and UC symptoms that make it challenging.
Try to keep the extra calories nutritious as you lost a lot nutrients during your flare. But do enjoy the occasional slice of cake without guilt, because you can