a
How can I use PaintCode to apply a different “style” to a button or other control while using the same event handling code?

How can I use PaintCode to apply a different “style” to a button or other control while using the same event handling code?

PaintCode can generate drawing methods that take parameters. For example, you can draw a button in PaintCode whose title text and color can be parameterized when calling the generated method. PaintCode also allows you to define color, gradients, shadows and images that will be included in the generated StyleKit class and accessible in your application.

Please, check out the "Button" canvas in the "Example.pcvd" document ("TabBar and Button" tab) in the example project. There is a "Color" library item with derived color "DarkColor". When you change the "Color", "DarkColor" will change accordingly using the color operation set in the Color Editing pop-over.
When you need to change the style of an object programatically, you can use "Variables"" or "Expressions" (read more in Variables and Expressions) linked to appropriate property of the object.

Look at "selected" and "highlighted" variables in "Variables" group of Library and on how StyleKit drawing method is used in viewWillAppear: (Swift: viewWillAppear(_:)) method of EXTabBarsAndButtonsViewController subclass.

If you just need to change a color of a shape, you can set the color in your Library to become a parameter of drawing method generated for your canvas. Check please the "bag" canvas in the "Example.pcvd" document ("TabBar and Button" tab) in example project.

Library item "bagColor" is set to be a "parameter" of drawing method of "bag" canvas. Check please EXTabBarsAndButtonsViewController in example project.