void Create( UIViewController parentViewController, UIView parentView, string headerText, string falseText, string trueText, bool requiredField, string attribKey ) { AttribKey = attribKey; // store our parent and the required flag ParentViewController = parentViewController; ParentView = parentView; Required = requiredField; // populate our values FalseText = falseText; TrueText = trueText; // setup the controls Layer.AnchorPoint = CGPoint.Empty; // header label Header = new UILabel( ); Header.Layer.AnchorPoint = CGPoint.Empty; Header.Text = headerText; Header.Font = FontManager.GetFont( Settings.General_BoldFont, Config.Instance.VisualSettings.SmallFontSize ); Theme.StyleLabel( Header, Config.Instance.VisualSettings.LabelStyle ); AddSubview( Header ); RequiredAnchor = new RequiredAnchor( ); RequiredAnchor.AttachToTarget( Header ); RequiredAnchor.SyncToTarget( ); RequiredAnchor.Hidden = !requiredField; // setup the value and button ToggleValue = new UIToggle( falseText, trueText, null ); ToggleValue.Layer.AnchorPoint = CGPoint.Empty; Theme.StyleToggle( ToggleValue, Config.Instance.VisualSettings.ToggleStyle ); AddSubview( ToggleValue ); }
void Create( UIViewController parentViewController, UIView parentView, string labelText, bool numbersOnly, bool requiredField, string attribKey ) { AttribKey = attribKey; ParentViewController = parentViewController; ParentView = parentView; Required = requiredField; NumbersOnly = numbersOnly; Layer.AnchorPoint = CGPoint.Empty; Header = new UILabel( ); Header.Layer.AnchorPoint = CGPoint.Empty; Header.Text = labelText; Theme.StyleLabel( Header, Config.Instance.VisualSettings.LabelStyle ); Header.Font = FontManager.GetFont( Settings.General_BoldFont, Config.Instance.VisualSettings.SmallFontSize ); Header.SizeToFit( ); AddSubview( Header ); RequiredAnchor = new RequiredAnchor( ); RequiredAnchor.AttachToTarget( Header ); RequiredAnchor.SyncToTarget( ); RequiredAnchor.Hidden = !requiredField; TextField = new UIInsetTextField( ); TextField.Layer.AnchorPoint = CGPoint.Empty; TextField.InputAssistantItem.LeadingBarButtonGroups = null; TextField.InputAssistantItem.TrailingBarButtonGroups = null; Theme.StyleTextField( TextField, Config.Instance.VisualSettings.TextFieldStyle ); TextField.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); AddSubview( TextField ); TextField.AutocorrectionType = UITextAutocorrectionType.No; }