Exemplo n.º 1
0
        private void UpdateHyperlinkLayout()
        {
            // Configure textContainer
            var textContainer = new NSTextContainer();

            textContainer.LineFragmentPadding  = 0;
            textContainer.LineBreakMode        = LineBreakMode;
            textContainer.MaximumNumberOfLines = (nuint)Lines;
            textContainer.Size = _drawRect.Size;

            // Configure layoutManager
            _layoutManager = new NSLayoutManager();
            _layoutManager.AddTextContainer(textContainer);

            // Configure textStorage
            var textStorage = new NSTextStorage();

            textStorage.SetString(GetAttributedText(NSAttributedStringTarget.NSTextStorage));
            textStorage.AddLayoutManager(_layoutManager);

            if (FeatureConfiguration.TextBlock.ShowHyperlinkLayouts)
            {
                textStorage.AddAttributes(
                    new UIStringAttributes()
                {
                    ForegroundColor = UIColor.Red
                },
                    new NSRange(0, textStorage.Length)
                    );
            }
        }