Reputation: 22282
I am trying to make a GradientView that is adjustable in Interface Builder. I've been able to get it so I can specify vertical vs horizontal, as well as start/stop colors:
I would like to be able to be able to include intermediate colors as well. Is this possible with the hooks @IBInspectable
/@IBDesignable
provide?
I could envision a +
button which would insert a row there and allow it to accommodate more colors.
(aside: I do wish I would have done this a long time ago, designers seem to throw lots of gradients at me, and I've always open coded them)
Upvotes: 1
Views: 368
Reputation: 131481
Sadly, I don't think you can do that. The IB interface for desigables is quite limited. You can only have single values of a limited number of types. I don't think there is any provision for arrays of things, which is what it sounds like you want.
You might be able to create more than one type of gradient view, each of which takes a different fixed number of colors (e.g. TwoColorGradientView, ThreeColorGradientView, FourColorGraidentView, and FiveColorGradientView). My guess is that a handful of classes would meet the vast majority of your needs.
Upvotes: 1