示例#1
0
        public TweetListCell()
            : base(UITableViewCellStyle.Default, Key)
        {
            _imageLoader = new ImageLoader ();

            BackgroundView = new UIImageView(UIImage.FromFile ("Backgrounds/table.png"));
            SelectedBackgroundView = new UIImageView(UIImage.FromFile ("Backgrounds/table_pressed.png"));

            _imageView = new UIImageView ();
            _imageView.Frame = new RectangleF (5, 5, 45, 45);
            ContentView.AddSubview (_imageView);

            _login = new UILabel (new RectangleF(57, 10, 240, 18));
            _login.BackgroundColor = UIColor.Clear;
            _login.Font = UIFont.BoldSystemFontOfSize (17);
            _login.TextColor = UIColor.FromRGB (0x00, 0x00, 0x00);
            _login.Text = "Имя пользователя";
            ContentView.AddSubview (_login);

            _text = new UILabel (new RectangleF(57, 30, 260, 16));
            _text.BackgroundColor = UIColor.Clear;
            _text.Font = UIFont.SystemFontOfSize (13);
            _text.TextColor = UIColor.FromRGB (0x89, 0x89, 0x89);
            _text.Text = "Первых 30 символов";
            ContentView.AddSubview (_text);

            _hours = new UILabel (new RectangleF(300, 15, 20, 12));
            _hours.BackgroundColor = UIColor.Clear;
            _hours.Font = UIFont.SystemFontOfSize (11);
            _hours.TextColor = UIColor.FromRGB (0x89, 0x89, 0x89);
            _hours.Text = "5 ч";
            ContentView.AddSubview (_hours);
        }
示例#2
0
        public DetailsView(TweetEntry tweet)
        {
            _imageLoader = new ImageLoader ();

            var bg = new UIImageView(UIImage.FromFile ("Tweet/bg.png"));
            AddSubview (bg);

            var imageView = new UIImageView ();
            imageView.Frame = new RectangleF (20, 30, 64, 64);

            _imageLoader.GetImage (tweet.User.ProfileImageUrl, (url, image) => InvokeOnMainThread(() =>
            {
                if (tweet.User.ProfileImageUrl == url)
                {
                    imageView.Image = image;
                }
            }));

            AddSubview (imageView);

            var author = new UILabel (new RectangleF(100, 50, 280, 300));
            author.TextColor = UIColor.FromRGB (0x44, 0x64, 0x8f);
            author.Font = UIFont.BoldSystemFontOfSize (16);
            author.BackgroundColor = UIColor.Clear;
            author.Text = tweet.User.Name;
            author.SizeToFit();
            AddSubview (author);

            var via = new UILabel (new RectangleF(100, 80, 280, 300));
            via.TextColor = UIColor.FromRGB (0x41, 0x41, 0x41);
            via.Font = UIFont.BoldSystemFontOfSize (12);
            via.BackgroundColor = UIColor.Clear;
            via.Text = "via Web";
            via.SizeToFit();
            AddSubview (via);

            var text = new UILabel (new RectangleF(20, 110, 280, 300));
            text.TextColor = UIColor.FromRGB (0x41, 0x41, 0x41);
            text.Font = UIFont.SystemFontOfSize (12);
            text.Lines = 0;
            text.BackgroundColor = UIColor.Clear;
            text.Text = HttpUtility.HtmlDecode (tweet.Text);
            text.SizeToFit();
            AddSubview (text);

            var line = new UIImageView (UIImage.FromFile ("Tweet/line.png"));
            line.Frame = new RectangleF (20, text.Frame.Bottom + 10, 154, 1);
            AddSubview (line);

            var date = new UILabel (new RectangleF(20, line.Frame.Bottom + 5, 280, 300));
            date.TextColor = UIColor.FromRGB (0x77, 0x77, 0x77);
            date.Font = UIFont.BoldSystemFontOfSize (10);
            date.BackgroundColor = UIColor.Clear;
            date.Text = tweet.CreatedAt.ToString ("d", CultureInfo.CreateSpecificCulture ("de-DE"));
            date.SizeToFit();
            AddSubview (date);

            var link = new UILabel (new RectangleF(date.Frame.Right + 25, date.Frame.Top, 280, 300));
            link.TextColor = UIColor.FromRGB (0x77, 0x77, 0x77);
            link.Font = UIFont.BoldSystemFontOfSize (10);
            link.BackgroundColor = UIColor.Clear;
            link.Text = GetLinkFromTag(HttpUtility.HtmlDecode (tweet.Source));
            link.SizeToFit();
            AddSubview (link);
        }