private UIView InitializeArticleDisplays(NewsArticle article) { var tempView = new UIView(); UILabel articleTitle; UIImageView articleImage; UILabel articleUrl; UILabel articleSource; UITextView articleDescription; // UILabels don't align to the top articleImage = new UIImageView(new RectangleF(Width / 20, (float)bar.Frame.Bottom + Height / 10, Width - Width / 10, Height / 3)); articleImage.Image = FromUrl(article.UrlToImage); tempView.AddSubview(articleImage); articleSource = new UILabel(new RectangleF(Width / 20, (float)articleImage.Frame.Top - 70, Width - Width / 10, 70)); articleSource.Text = article.Source.Name; articleSource.Font = UIFont.SystemFontOfSize(15 + (int)(Width / 20)); articleSource.AdjustsFontSizeToFitWidth = true; articleSource.AdjustsFontForContentSizeCategory = true; articleSource.TranslatesAutoresizingMaskIntoConstraints = true; articleSource.SizeToFit(); articleSource.Frame = new RectangleF(Width / 20, (float)(articleImage.Frame.Top - articleSource.Frame.Height), Width - Width / 10, (float)articleSource.Frame.Height); articleSource.TextColor = UIColor.Black; articleSource.BackgroundColor = UIColor.FromRGBA(0, 0, 0, 30); tempView.AddSubview(articleSource); articleUrl = new UILabel(new RectangleF(Width / 20, (float)articleImage.Frame.Bottom, Width - Width / 10, Height / 10)); articleUrl.Lines = 1; articleUrl.Text = article.Url; articleUrl.Font = UIFont.SystemFontOfSize(6 + (int)(Width / 50)); articleUrl.TranslatesAutoresizingMaskIntoConstraints = true; articleUrl.SizeToFit(); articleUrl.Frame = new RectangleF(Width / 20, (float)articleImage.Frame.Bottom, Width - Width / 10, (float)articleUrl.Frame.Height); articleUrl.TextColor = UIColor.DarkGray; articleUrl.BackgroundColor = UIColor.FromRGBA(0, 0, 0, 30); tempView.AddSubview(articleUrl); articleTitle = new UILabel(new RectangleF(Width / 20, (float)articleUrl.Frame.Bottom + Height / 30, Width - Width / 10, Height / 4)); articleTitle.Lines = 3; articleTitle.Text = article.Title; articleTitle.Font = UIFont.SystemFontOfSize(13 + (int)(Width / 35)); articleTitle.TranslatesAutoresizingMaskIntoConstraints = true; articleTitle.SizeToFit(); articleTitle.Frame = new RectangleF(Width / 20, (float)articleUrl.Frame.Bottom + Height / 30, Width - Width / 10, (float)articleTitle.Frame.Height); articleTitle.TextColor = UIColor.Black; articleTitle.Layer.CornerRadius = 3; articleTitle.BackgroundColor = UIColor.Clear; tempView.AddSubview(articleTitle); articleDescription = new UITextView(new RectangleF(Width / 20, (float)articleTitle.Frame.Bottom, Width - Width / 10, (float)(Height * 4 / 5 - articleTitle.Frame.Bottom))); articleDescription.Text = article.Description; articleDescription.Font = UIFont.SystemFontOfSize(10 + (int)(Width / 50)); articleDescription.TextColor = UIColor.Black; articleDescription.BackgroundColor = UIColor.Clear; articleDescription.Editable = false; articleDescription.Selectable = false; articleDescription.ScrollEnabled = false; articleDescription.TextContainer.LineBreakMode = UILineBreakMode.TailTruncation; tempView.AddSubview(articleDescription); return(tempView); }