Exemple #1
0
        public void UpdateFrame()
        {
            var style = TextStyle.GetStyle(StyleID);

            // Offset the frame if needed
            if (_updateConstraints && style.LineHeight < 0f)
            {
                var heightOffset = style.GetLineHeightOffset();
                var targetFrame  = Target.Frame;
                targetFrame.Height = (nfloat)Math.Ceiling(targetFrame.Height) + heightOffset;

                if (Target.Constraints.Length > 0)
                {
                    foreach (var constraint in Target.Constraints)
                    {
                        if (constraint.FirstAttribute == NSLayoutAttribute.Height)
                        {
                            constraint.Constant = targetFrame.Height;
                            break;
                        }
                    }
                }
                else
                {
                    Target.Frame = targetFrame;
                }
            }
        }
Exemple #2
0
        public void UpdateDisplay()
        {
            var type  = Target.GetType();
            var style = TextStyle.GetStyle(StyleID);

            if (type == TextStyle.typeLabel)
            {
                var label = Target as UILabel;
                TextStyle.StyleUILabel(label, style, !ContainsHtml);
                label.AttributedText = AttributedValue;
            }
            else if (type == TextStyle.typeTextView)
            {
                var textView = Target as UITextView;
                TextStyle.StyleUITextView(textView, style, !ContainsHtml);
                textView.AttributedText = AttributedValue;
            }
            else if (type == TextStyle.typeTextField)
            {
                var textField = Target as UITextField;
                TextStyle.StyleUITextField(textField, style, true);
                textField.AttributedText = AttributedValue;
            }
            else
            {
                throw new NotSupportedException("The specified type is not supported, please use a UILabel, UITextView or UITextField: " + type.ToString());
            }
        }
Exemple #3
0
        public void UpdateText(string value = null)
        {
            if (!String.IsNullOrEmpty(value))
            {
                _rawText = value;
            }

            var style = TextStyle.GetStyle(StyleID);

            TextValue = TextStyle.ParseString(style, _rawText);

            AttributedValue = ContainsHtml ? TextStyle.CreateHtmlString(TextValue, CustomTags) : TextStyle.CreateStyledString(style, TextValue);
        }