Exemple #1
0
        void Setup()
        {
            //Defining attibutes inorder to format the embedded link
            NSAttributedStringDocumentAttributes documentAttributes = new NSAttributedStringDocumentAttributes {
                DocumentType = NSDocumentType.HTML
            };

            documentAttributes.StringEncoding = NSStringEncoding.UTF8;
            NSError            error            = null;
            NSAttributedString attributedString = new NSAttributedString(NSData.FromString(Text, NSStringEncoding.UTF8), documentAttributes, ref error);

            //Ensuring text is resiezed correctly when font size is increased
            StyleUtil.InitTextViewWithSpacingAndUrl(this, FontType.FontRegular, attributedString, 1.28, 16, 22);
            TextColor = UIColor.White;
            //ForegroundColor sets the color of the links. UnderlineStyle determins if the link is underlined, 0 without underline 1 with underline.
            WeakLinkTextAttributes = new NSDictionary(UIStringAttributeKey.ForegroundColor, "#FADC5D".ToUIColor(), UIStringAttributeKey.UnderlineStyle, new NSNumber(1));
        }
Exemple #2
0
        private void SetupSubTextWithLink(string text, UITextView textView)
        {
            // Necessary to unify horizontal alignment with the rest of the text on the page
            textView.TextContainerInset = UIEdgeInsets.Zero;
            textView.TextContainer.LineFragmentPadding = 0;

            //Defining attibutes inorder to format the embedded link
            NSAttributedStringDocumentAttributes documentAttributes = new NSAttributedStringDocumentAttributes {
                DocumentType = NSDocumentType.HTML
            };

            documentAttributes.StringEncoding = NSStringEncoding.UTF8;
            NSError            error            = null;
            NSAttributedString attributedString = new NSAttributedString(NSData.FromString(text, NSStringEncoding.UTF8), documentAttributes, ref error);

            //Ensuring text is resiezed correctly when font size is increased
            StyleUtil.InitTextViewWithSpacingAndUrl(textView, StyleUtil.FontType.FontRegular, attributedString, 1.28, 16, 22);

            textView.TextColor = ColorHelper.TEXT_COLOR_ON_BACKGROUND;

            //ForegroundColor sets the color of the links. UnderlineStyle determins if the link is underlined, 0 without underline 1 with underline.
            textView.WeakLinkTextAttributes = new NSDictionary(UIStringAttributeKey.ForegroundColor, ColorHelper.LINK_COLOR, UIStringAttributeKey.UnderlineStyle, new NSNumber(1));
        }