c# - Custom control / UIView in Xamarin.iOS with design-time properties -
i creating user interface ios app , looking correct way create reusable custom control. got working when running app, @ design time setting "exported" properties has no visible effect in designer. think doing fundamentally wrong, perhaps give me guidance
what doing:
- i have created subclass of
uicontrol
. - in constructor call
initialize
method. - in
initialize
method, add several subviews , constraints layout them within control
here hollowed out code shows above:
[register("rangedvalueselector"), designtimevisible(true)] public sealed class rangedvalueselector : uicontrol { public rangedvalueselector(intptr p) : base(p) { initialize(); } public rangedvalueselector() { initialize(); } public int horizontalbuttonspacing { { return _horizontalbuttonspacing; } set { _horizontalbuttonspacing = value; } } [export("labelboxverticalinset"), browsable(true)] public int labelboxverticalinset { { return _labelboxverticalinset; } set { _labelboxverticalinset = value; } } private void initialize() { //code creates , add subviews //code creates , add required constraints, of should depend on design time properties } }
so control works fine if set exported properties via designer, not have immediate effect in designer itself.
what suggested way of having design-time settable properties change constraint values? avoid having recreate subviews each time in code or in designer sets property.
Comments
Post a Comment