示例#1
0
        void initElement()
        {
            circleView = new UIView(new CGRect(0, 10, 10, 10))
            {
                BackgroundColor = BackColor
            };                                                                                        //posy=10
            circleView.Layer.CornerRadius  = 5;
            circleView.Layer.MasksToBounds = true;
            Add(circleView);

            textLabel = new UILabel(new CGRect(24, 0, textWidth, 18));
            textLabel.LineBreakMode = UILineBreakMode.WordWrap;
            textLabel.TextColor     = UIColor.Gray;
            textLabel.Font          = UIFont.FromName(fontName, 24);
            //textLabel.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. End m ipsum dolor sit amet, consectetur adipiscing elit. End ";
            textLabel.Text = content;
            textHeight     = YConstants.ResizeHeigthWithText(textLabel, maxHeight: 960f);
            Add(textLabel);


            cheight = textHeight + 12;
            var frame = new CGRect(30, position, 70, textHeight);

            Frame = frame;

            //BackgroundColor = UIColor.Red;
        }
示例#2
0
        void initResizableText()
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;


            contentLabel = new UILabel(new CGRect(24, 0, 720, 100));
            contentLabel.LineBreakMode = UILineBreakMode.WordWrap;
            contentLabel.TextColor     = source.Color;         // UIColor.Purple;
            contentLabel.Font          = UIFont.FromName(fontName, 24);
            //contentLabel.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation END";
            //contentLabel.Text = source.Paragraph ;

            var myHtmlText = source.Paragraph;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlData = NSData.FromString(myHtmlText, NSStringEncoding.Unicode);

            contentLabel.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            contentLabel.Font           = UIFont.FromName(fontName, 24);

            contentHeight = YConstants.ResizeHeigthWithText(contentLabel, maxHeight: 960f);

            authorLabel = new UILabel(new CGRect(24, contentHeight + 12, 500, 24));
            authorLabel.LineBreakMode = UILineBreakMode.WordWrap;
            authorLabel.TextColor     = UIColor.Gray;
            authorLabel.Font          = UIFont.FromName(fontName, 16);
            //authorLabel.Text = "Author de la frase";
            authorLabel.Text = source.Author;
            authorHeight     = YConstants.ResizeHeigthWithText(authorLabel, maxHeight: 960f);

            borderHeight = authorHeight + contentHeight + 12;
        }
        void initResizableText()
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;

            titleLabel = new UILabel(new CGRect(0, 0, 800, 20));
            titleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            titleLabel.TextColor     = UIColor.Black;
            titleLabel.Font          = UIFont.FromName(YConstants.FontName, 32);
            //titleLabel.Text = "Aves Tipicas";
            //titleLabel.Text = source.Title ;
            var myHtmlTitle = source.Title;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlDataT = NSData.FromString(myHtmlTitle, NSStringEncoding.Unicode);

            titleLabel.AttributedText = new NSAttributedString(myHtmlDataT, attr, ref nsError);
            titleLabel.Font           = UIFont.FromName(YConstants.FontName, 32);

            titleHeight = YConstants.ResizeHeigthWithText(titleLabel, maxHeight: 960f);

            contentLabel = new UILabel(new CGRect(0, 0 + titleHeight + 30, 800, 200));
            contentLabel.LineBreakMode = UILineBreakMode.WordWrap;
            contentLabel.TextColor     = UIColor.Gray;
            contentLabel.Font          = UIFont.FromName(YConstants.FontName, 24);
            //contentLabel.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation END";
            //contentLabel.Text =  source.Paragraph ;

            //Next text from HTML

            //var myHtmlText = source.Paragraph; //"<b>Hello</b> <i>Everyone</i>";
            //contentLabel.AttributedText =  new  NSAttributedString(myHtmlText, attr, ref nsError);


            var myHtmlText = source.Paragraph;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlData = NSData.FromString(myHtmlText, NSStringEncoding.Unicode);

            contentLabel.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            contentLabel.Font           = UIFont.FromName(YConstants.FontName, 24);

            contentHeight = YConstants.ResizeHeigthWithText(contentLabel, maxHeight: 960f);

            borderHeight = titleHeight + contentHeight;
        }
示例#4
0
        string titleText = "";        //LOL THIS IS  A TITLE " ;
        public void setName(string name, UIColor foreground)
        {
            //view for dinamic title
            titleView           = new UIView(new CGRect(120, 164, 200, 50));
            titleView.Transform = CGAffineTransformMakeSkew(-1 * skew, 44);
            Add(titleView);

            //text  title
            titleLabel = new UILabel(new CGRect(0, 0, 196, 22));
            titleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            titleLabel.Text          = name;
            titleLabel.TextColor     = foreground;
            titleLabel.Font          = UIFont.FromName("HelveticaNeue", 20);

            var text_height = YConstants.ResizeHeigthWithText(titleLabel, 100);

            titleLabel.Frame = new CGRect(0, (55 - text_height) / 2, 196, text_height);

            titleView.Add(titleLabel);
        }
示例#5
0
        void initResizableText()
        {
            titleLabel = new UILabel(new CGRect(46, 20, 800, 32));
            titleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            titleLabel.TextColor     = UIColor.Purple;
            titleLabel.Font          = UIFont.FromName(fontName, 36);
            //titleLabel.Text = "Aves Tipicas";
            titleLabel.Text = source.Title;
            titleHeight     = YConstants.ResizeHeigthWithText(titleLabel, maxHeight: 960f);

            contentHeight = 82;
            for (int i = 0; i < source.Itemize.Count; i++)
            {
                ItemizeElement el = new ItemizeElement(contentHeight);
                el.BackColor   = source.Color;
                el.Content     = source.Itemize [i].Text;
                contentHeight += el.GetHeight();
                elements.Add(el);
            }

            borderHeight = contentHeight + separation;
        }
        void initResizableText()
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;


            contentLabel = new UILabel(new CGRect(26, 146, 748, 200));
            contentLabel.LineBreakMode = UILineBreakMode.WordWrap;
            contentLabel.TextColor     = UIColor.Gray;
            contentLabel.Font          = UIFont.FromName(YConstants.FontName, 24);
            //mainView.Add (contentLabel);

            //contentLabel.Text = source.Paragraph;   //"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. quis nostrud exercitation END";
            var myHtmlTitle = source.Paragraph;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlDataT = NSData.FromString(myHtmlTitle, NSStringEncoding.Unicode);

            contentLabel.AttributedText = new NSAttributedString(myHtmlDataT, attr, ref nsError);
            contentLabel.Font           = UIFont.FromName(YConstants.FontName, 24);

            contentHeight = YConstants.ResizeHeigthWithText(contentLabel, maxHeight: 960f);
        }
示例#7
0
        void addTitle(string t, string st)
        {
            //ATT fpr HTML
            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;

            nfloat xpos = 474, ypos = 380, delta = 74, pw = 486;

            //description
            pageDescription = new UILabel(new CGRect(xpos, ypos, pw, 70))
            {
                //Text = "SUBTITULOOOOO" ,//st ,
                Font          = UIFont.FromName("HelveticaNeue", 24),
                TextColor     = UIColor.White,
                LineBreakMode = UILineBreakMode.WordWrap,
                TextAlignment = UITextAlignment.Right
            };
            //Adding text HTML
            var myHtmlText = st;             //"<b>Hello</b> <i>Everyone</i> ÆØÅ";
            var myHtmlData = NSData.FromString(myHtmlText, NSStringEncoding.Unicode);

            pageDescription.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError);
            pageDescription.Font           = UIFont.FromName("HelveticaNeue", 24);
            pageDescription.TextColor      = UIColor.White;
            pageDescription.LineBreakMode  = UILineBreakMode.WordWrap;
            pageDescription.TextAlignment  = UITextAlignment.Right;

            var d_h = YConstants.ResizeHeigthWithText(pageDescription, 300);

            ypos = position - d_h - delta;
            pageDescription.Frame = new CGRect(xpos, ypos, pw, d_h);
            contentView.Add(pageDescription);

            //line
            ypos -= 20;
            var line = new UIView(new CGRect(xpos, ypos, pw, 1))
            {
                BackgroundColor = UIColor.White
            };

            contentView.Add(line);
            ypos -= 20;

            //title
            pageTitle = new UILabel(new CGRect(xpos, ypos, pw, 70))
            {
                Text          = t,
                Font          = UIFont.FromName("HelveticaNeue", 42),
                TextColor     = UIColor.White,
                LineBreakMode = UILineBreakMode.WordWrap,
                TextAlignment = UITextAlignment.Right
            };
            var t_h = YConstants.ResizeHeigthWithText(pageTitle, 200);

            ypos -= t_h;

            pageTitle.Frame = new CGRect(xpos, ypos, pw, t_h);
            contentView.Add(pageTitle);
        }