public ImageAndTitleHeaderView() : base(new CGRect(0, 0, 320f, 100f)) { ImageButton = new UIButton(UIButtonType.Custom); ImageButton.Frame = new CGRect(0, 0, 80, 80); ImageButton.TouchUpInside += (sender, e) => { if (ImageButtonAction != null) { ImageButtonAction(); } }; Add(ImageButton); _imageView = new UIImageView(); _imageView.Frame = new CGRect(0, 0, 80, 80); _imageView.BackgroundColor = UIColor.White; _imageView.Layer.BorderWidth = 2f; _imageView.Layer.BorderColor = UIColor.White.CGColor; ImageButton.Add(_imageView); _label = new UILabel(); _label.TextAlignment = UITextAlignment.Center; _label.Lines = 0; _label.Font = UIFont.PreferredHeadline; Add(_label); _label2 = new UILabel(); _label2.Hidden = true; _label2.TextAlignment = UITextAlignment.Center; _label2.Font = UIFont.PreferredSubheadline; _label2.Lines = 0; Add(_label2); _seperatorView = new UIView(); _seperatorView.BackgroundColor = UIColor.FromWhiteAlpha(214.0f / 255.0f, 1.0f); Add(_seperatorView); _subView = new UIView(); _subView.Frame = new CGRect(56, 56, 22, 22); _subView.Layer.CornerRadius = 10f; _subView.Layer.MasksToBounds = true; _subView.BackgroundColor = UIColor.White; _subView.Hidden = true; ImageButton.Add(_subView); _subImageView = new UIImageView(new CGRect(0, 0, _subView.Frame.Width - 4f, _subView.Frame.Height - 4f)); _subImageView.Center = new CGPoint(11f, 11f); _subView.Add(_subImageView); EnableSeperator = false; RoundedImage = true; }
public ImageAndTitleHeaderView() : base(new CGRect(0, 0, 320f, 100f)) { ImageButton = new UIButton(UIButtonType.Custom); ImageButton.Frame = new CGRect(0, 0, 80, 80); ImageButton.TouchUpInside += (sender, e) => { if (ImageButtonAction != null) ImageButtonAction(); }; Add(ImageButton); _imageView = new UIImageView(); _imageView.Frame = new CGRect(0, 0, 80, 80); _imageView.BackgroundColor = UIColor.White; _imageView.Layer.BorderWidth = 2f; _imageView.Layer.BorderColor = UIColor.White.CGColor; ImageButton.Add(_imageView); _label = new UILabel(); _label.TextAlignment = UITextAlignment.Center; _label.Lines = 0; _label.Font = UIFont.PreferredHeadline; Add(_label); _label2 = new UILabel(); _label2.Hidden = true; _label2.TextAlignment = UITextAlignment.Center; _label2.Font = UIFont.PreferredSubheadline; _label2.Lines = 0; Add(_label2); _seperatorView = new UIView(); _seperatorView.BackgroundColor = UIColor.FromWhiteAlpha(214.0f / 255.0f, 1.0f); Add(_seperatorView); _subView = new UIView(); _subView.Frame = new CGRect(56, 56, 22, 22); _subView.Layer.CornerRadius = 10f; _subView.Layer.MasksToBounds = true; _subView.BackgroundColor = UIColor.White; _subView.Hidden = true; ImageButton.Add(_subView); _subImageView = new UIImageView(new CGRect(0, 0, _subView.Frame.Width - 4f, _subView.Frame.Height - 4f)); _subImageView.Center = new CGPoint(11f, 11f); _subView.Add(_subImageView); EnableSeperator = false; RoundedImage = true; }
private BlurredAlertView(string text) { _label = new UILabel(); _label.Lines = 0; _label.Text = text; _label.Font = UIFont.PreferredHeadline; _label.TextAlignment = UITextAlignment.Center; _label.TextColor = UIColor.White; _button = new UIButton(UIButtonType.Custom); var buttonLabel = new UILabel(); buttonLabel.Text = "Ok"; buttonLabel.Font = UIFont.PreferredBody.MakeBold(); buttonLabel.TextColor = UIColor.White; buttonLabel.SizeToFit(); buttonLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; _button.Add(buttonLabel); _button.Layer.BorderColor = UIColor.White.CGColor; _button.Layer.BorderWidth = 1f; _button.Layer.CornerRadius = 6f; _button.Layer.MasksToBounds = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.BackgroundColor = UIColor.White; var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty"), filledImage: UIImage.FromBundle("Stars/filled"), chosenImage: UIImage.FromBundle("Stars/chosen")); // [Optional] Put a little space between the rating items. ratingConfig.ItemPadding = 5f; backgroundButton = UIButton.FromType(UIButtonType.RoundedRect); backgroundButton.SetBackgroundImage(UIImage.FromBundle("Background/background").StretchableImage(0, 0), UIControlState.Normal); backgroundButton.Frame = new CGRect(new CGPoint(24f, 24f), new CGSize(View.Bounds.Width - (2f * 24f), 125f)); var ratingFrame = backgroundButton.Bounds; ratingView = new PDRatingView(ratingFrame, ratingConfig); // [Optional] Set the current rating to display. decimal rating = 3.58m; //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); ratingView.AverageRating = rating; // [Optional] Make it read-only to keep the user from setting a rating. //StarRating.UserInteractionEnabled = false; // [Optional] Attach to the rating event to do something with the chosen value. ratingView.RatingChosen += (sender, e) => { (new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show(); }; backgroundButton.Add(ratingView); View.Add(backgroundButton); }
private static UIView GetBackButton(float viewWidth, float viewHeight) { UIView view = new UIView(new RectangleF(0, viewHeight - BUTTONHEIGHT, BUTTONWIDTH, BUTTONHEIGHT)); view.BackgroundColor = UIColor.Clear; UIButton button = new UIButton(new RectangleF(0, 0, BUTTONWIDTH, BUTTONHEIGHT)); button.SetImage(BACKBUTTONIMAGEOUT, UIControlState.Normal); button.AdjustsImageWhenDisabled = false; button.AdjustsImageWhenHighlighted = false; UILabel backTitle = new UILabel(new RectangleF(50, 10, 60, 25)); backTitle.Text = "返回"; backTitle.TextColor = UIColor.FromRGB(255, 255, 255); backTitle.Font = UIFont.FromName(FONTFAMILY, 18); backTitle.TextAlignment = UITextAlignment.Center; backTitle.BackgroundColor = UIColor.Clear; button.Add(backTitle); button.TouchUpInside += (sender, e) => { button.SetImage(BACKBUTTONIMAGEOUT, UIControlState.Normal); CloseTimePiker(); }; button.TouchDown += (sender, e) => { button.SetImage(BACKBUTTONIMAGEIN, UIControlState.Normal); }; button.TouchDragInside += (sender, e) => { button.SetImage(BACKBUTTONIMAGEOUT, UIControlState.Normal); }; view.Add(button); return view; }
public static UIView GetCustomButton(float viewWidth, float viewHeight, CustomAlertType type, string message) { float width = 300f; float height = 60f; float x = (viewWidth - width) / 2; float y = (viewHeight - height * 1.5f) / 2; UIView buttonView = new UIView(new RectangleF (x, y, width, height)); buttonView.BackgroundColor = UIColor.Clear; UIButton alertButton = new UIButton (new RectangleF(0, 0, width, height)); alertButton.BackgroundColor = UIColor.Clear; alertButton.SetImage(ALERTMESSAGEBACK, UIControlState.Normal); alertButton.AdjustsImageWhenHighlighted = false; alertButton.TouchUpInside += (sender, e) => { CloseCustomAlert(); }; UIImageView imageView = new UIImageView(new RectangleF(20, 20, 20, 20)); switch (type) { case CustomAlertType.Error: imageView.Image = ALERTMESSAGEERROR; break; case CustomAlertType.OK:break; case CustomAlertType.Warning:imageView.Image = ALERTMESSAGEWARNING; break; case CustomAlertType.Wait:imageView.Image = ALERTMESSAGEWAIT; break; } UILabel messageLable = new UILabel(); messageLable.Text = message; messageLable.Font = UIFont.FromName(FONTFAMILY, 15); messageLable.TextColor = UIColor.FromRGB(100, 100, 100); messageLable.Frame = new RectangleF(50, 10, width - 80, height - 20); messageLable.TextAlignment = UITextAlignment.Left; messageLable.BackgroundColor = UIColor.Clear; alertButton.Add(imageView); alertButton.Add(messageLable); buttonView.Add(alertButton); return buttonView; }
public RetryListView(UIImage image, string text, Action retryAction) : base(new CGRect(0, 0, 320f, 480f * 2f)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; ImageView = new UIImageView(); Title = new UILabel(); Button = new UIButton(UIButtonType.Custom); ImageView.Frame = new CGRect(0, 0, 64f, 64f); ImageView.TintColor = DefaultColor; ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; ImageView.Image = image; Add(ImageView); Title.Frame = new CGRect(0, 0, 256f, 20f); Title.Text = text; Title.TextAlignment = UITextAlignment.Center; Title.Font = UIFont.PreferredHeadline; Title.TextColor = DefaultColor; Add(Title); var buttonLabel = new UILabel(); buttonLabel.Text = "Retry"; buttonLabel.Font = UIFont.PreferredBody.MakeBold(); buttonLabel.TextColor = DefaultColor; buttonLabel.SizeToFit(); buttonLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; Button.Add(buttonLabel); Button.Frame = new CGRect(0, 0, 96, 32); Button.Layer.BorderColor = DefaultColor.CGColor; Button.Layer.BorderWidth = 1f; Button.Layer.CornerRadius = 6f; Button.Layer.MasksToBounds = true; Button.GetClickedObservable().Subscribe(_ => retryAction()); Add(Button); BackgroundColor = UIColor.White; }
public static UIView GetAgreementView(float viewWidth, float viewHeight) { UIView View = new UIView(new RectangleF((viewWidth - 290) / 2, 25, 290, 450)); View.BackgroundColor = UIColor.Clear; UIImageView backImageView = new UIImageView(new RectangleF(0, 0, 290, 450)); backImageView.Image = AGREEMENTBACKIMAGE; backImageView.BackgroundColor = UIColor.Clear; UILabel titleLable = new UILabel(new RectangleF(20, 12, 100, 20)); titleLable.TextAlignment = UITextAlignment.Left; titleLable.TextColor = UIColor.FromRGB(200, 20, 30); titleLable.Font = UIFont.FromName(FONTFAMILY, 16); titleLable.BackgroundColor = UIColor.Clear; titleLable.Text = "使用协议"; UIWebView textView = new UIWebView(new RectangleF(22, 50, 247, 330)); textView.LoadHtmlString(html, new NSUrl(NSBundle.MainBundle.BundlePath, true)); textView.BackgroundColor = UIColor.FromRGB(250, 250, 250); UIButton button = new UIButton(new RectangleF(15, 385 , 257, 50)); button.SetImage(AGREEMENTBUTTONOUT, UIControlState.Normal); button.AdjustsImageWhenHighlighted = false; UILabel buttonTitle = new UILabel(new RectangleF(100, 0, 60, 50)); buttonTitle.Text = "确定"; buttonTitle.Font = UIFont.FromName(FONTFAMILY, 18); buttonTitle.TextColor = UIColor.FromRGB(255, 255, 255); buttonTitle.BackgroundColor = UIColor.Clear; buttonTitle.TextAlignment = UITextAlignment.Center; button.Add(buttonTitle); button.TouchUpInside += (sender, e) => { button.SetImage(AGREEMENTBUTTONIN, UIControlState.Normal); CloseAgreement(); }; button.TouchDown += (sender, e) => { button.SetImage(AGREEMENTBUTTONIN, UIControlState.Normal); }; button.TouchDragInside += (sender, e) => { button.SetImage(AGREEMENTBUTTONOUT, UIControlState.Normal); }; View.Add(backImageView); View.Add(titleLable); View.Add(textView); View.Add(button); return View; }
private void BuildLayout(){ this.View.BackgroundColor = UIColor.Red; //- Add Logo UIImage ideabagLogo = UIImage.FromBundle("Login-Logo").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal); UIImageView ideabagLogView = new UIImageView (ideabagLogo); ideabagLogView.Frame = new CoreGraphics.CGRect (97, 31, 184, 294); this.View.Add (ideabagLogView); //- Signup Image UIButton btnSignupImage = new UIButton(); btnSignupImage.Frame = new CoreGraphics.CGRect (194, 313, 150, 50); UIImage signupImage = UIImage.FromBundle ("btnSignup-unselected").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal); UIImageView signupImageView = new UIImageView (signupImage); btnSignupImage.Add (signupImageView); this.View.Add (btnSignupImage); //- Username text box and background UIImageView usernameBackgroundView = new UIImageView(new UIImage ( new CoreImage.CIImage (UIImage.FromBundle ("login-form-background").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal)) )); usernameBackgroundView.Frame = new CoreGraphics.CGRect (0, 366, 380, 50); UITextField tfUsername = new UITextField (new CoreGraphics.CGRect (16, 376, 343, 30)); tfUsername.Font = UIFont.FromName ("Avenir Book", 17); tfUsername.Alpha = 1; tfUsername.BackgroundColor = UIColor.Clear; tfUsername.TextColor = UIColor.White; tfUsername.Placeholder = "Email or Username"; this.View.Add (usernameBackgroundView); this.View.Add (tfUsername); //- Password text box and background UIImageView passwordBackgroundView = new UIImageView(new UIImage ( new CoreImage.CIImage (UIImage.FromBundle ("login-form-background").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal)) )); passwordBackgroundView.Frame = new CoreGraphics.CGRect (0, 418, 380, 50); UITextField tfPassword = new UITextField ( new CoreGraphics.CGRect (16, 428, 343, 30)); tfPassword.Font = UIFont.FromName ("Avenir Book", 17); tfPassword.Alpha = 1; tfPassword.BackgroundColor = UIColor.Clear; tfPassword.TextColor = UIColor.White; tfPassword.Placeholder = "Password"; this.View.Add (passwordBackgroundView); this.View.Add (tfPassword); //- Login Button UIButton btnLogin = new UIButton(new CoreGraphics.CGRect(59, 479, 256, 49)); btnLogin.Font = UIFont.FromName ("Avenir Book", 22); btnLogin.BackgroundColor = new UIColor (new CoreGraphics.CGColor (255, 255, 255, 0.85f)); btnLogin.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal); btnLogin.SetTitleColor (UIColor.Red, UIControlState.Normal); btnLogin.SetTitle ("Login", UIControlState.Normal); btnLogin.Layer.CornerRadius = 5; btnLogin.ClipsToBounds = true; this.View.Add (btnLogin); //- Forgot password UIButton btnForgotPassword = new UIButton(new CoreGraphics.CGRect(94,556, 187, 30)); btnForgotPassword.Font = UIFont.FromName ("Avenir Book", 19); btnForgotPassword.SetTitleColor (UIColor.White, UIControlState.Normal); btnForgotPassword.SetTitleShadowColor (UIColor.DarkTextColor, UIControlState.Normal); btnForgotPassword.SetTitle ("Forgot Password?", UIControlState.Normal); this.View.Add (btnForgotPassword); //- Facebook login UIButton btnFacebookLogin = new UIButton(new CoreGraphics.CGRect(73, 623, 228, 32)); btnFacebookLogin.Font = UIFont.FromName ("Avenir Book", 18); btnFacebookLogin.SetTitle ("Login with Facebook", UIControlState.Normal); btnFacebookLogin.SetTitleColor (UIColor.White, UIControlState.Normal); btnFacebookLogin.SetImage ( UIImage.FromBundle ("Facebook-login").ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal); this.View.Add (btnFacebookLogin); }
/// <summary> /// Initializes a new instance of the <see cref="JZMultiChoice.JZMultiChoicesCircleButton"/> class. /// </summary> /// <param name="point">Center Point.</param> /// <param name="icon">Center Icon</param> /// <param name="sRadius">Small radius.</param> /// <param name="bRadius">Big radius.</param> /// <param name="mMenuItems">Choice items</param> /// <param name="isParallex">If set to <c>true</c> is parallex.</param> /// <param name="parallex">Parallex amount</param> /// <param name="vc">ViewContoller.</param> public JZMultiChoicesCircleButton(CGPoint point, UIImage icon , float sRadius, float bRadius, ChoiceItemCollection mMenuItems, bool isParallex , float parallex, UIViewController vc) : this(UIScreen.MainScreen.Bounds) { this.SmallRadius = sRadius; this.BigRadius = bRadius; this.isTouchDown = false; this.CenterPoint = point; this.IconImage = icon; this.ParallexParameter = parallex; this.Parallex = isParallex; this.ResponderUIVC = vc; BackgroundView = new UIView(new CGRect(point.X - sRadius, point.Y - sRadius, sRadius * 2, sRadius * 2)); BackgroundView.BackgroundColor = new UIColor(0f, 0f, 0f, 0.7f); BackgroundView.Layer.CornerRadius = sRadius; this.Add(BackgroundView); SmallButton = new UIButton(new CGRect(point.X - sRadius, point.Y - sRadius, sRadius * 2, sRadius * 2)); SmallButton.Layer.CornerRadius = sRadius; SmallButton.Layer.BackgroundColor = UIColor.FromRGBA(252.0f / 255.0f, 81.0f / 255.0f, 106.0f / 255.0f, 1.0f).CGColor; SmallButton.Layer.ShadowColor = UIColor.Black.CGColor; SmallButton.Layer.ShadowOffset = new CGSize(0.0f, 6.0f); SmallButton.Layer.ShadowOpacity = 0.3f; SmallButton.Layer.ShadowRadius = 4.0f; SmallButton.Layer.ZPosition = bRadius; SmallButton.SetImage(IconImage, UIControlState.Normal); SmallButton.AddTarget(TouchDown, UIControlEvent.TouchDown); SmallButton.AddTarget(this, new Selector("TouchDrag:withEvent:"), UIControlEvent.TouchDragInside); SmallButton.AddTarget(this, new Selector("TouchDrag:withEvent:"), UIControlEvent.TouchDragOutside); SmallButton.AddTarget(this, new Selector("TouchUpInside:withEvent:"), UIControlEvent.TouchUpInside); SmallButton.AddTarget(TouchUpOutside, UIControlEvent.TouchUpOutside); this.Add(SmallButton); label = new CATextLayer(); label.FontSize = 9.0f; label.String = @"Choose:"; label.FontSize = 40; label.SetFont(@"ArialMT"); label.AlignmentMode = CATextLayer.AlignmentCenter; label.ForegroundColor = UIColor.FromWhiteAlpha(1.0f, 0.0f).CGColor; label.Frame = new CGRect(-SmallRadius * 3, -52, SmallRadius * 8, 100); var UnScaleFactor = SmallRadius / BigRadius; label.Transform = CATransform3D.MakeScale(UnScaleFactor, UnScaleFactor, 1.0f); SmallButton.Layer.AddSublayer(label); var TransformPara = BigRadius / SmallRadius; var MultiChoiceRadius = (BigRadius + SmallRadius) / 8 / TransformPara; this.mItems = mMenuItems; IconArray = new List <UIImageView> (); var number = mMenuItems.Count; foreach (var aItem in this.mItems) { var i = mItems.IndexOf(aItem); var XOffest = 4 * MultiChoiceRadius * Math.Cos(2 * Math.PI * i / number); var YOffest = 4 * MultiChoiceRadius * Math.Sin(2 * Math.PI * i / number); var IconImageView = new UIImageView(new CGRect(sRadius + XOffest - MultiChoiceRadius, sRadius + YOffest - MultiChoiceRadius, MultiChoiceRadius * 2, MultiChoiceRadius * 2)); IconImageView.Image = aItem.Icon; IconImageView.Alpha = 0.0f; IconImageView.Hidden = true; SmallButton.Add(IconImageView); SmallButton.BringSubviewToFront(IconImageView); IconImageView.Layer.ContentsScale = UIScreen.MainScreen.Scale * BigRadius / SmallRadius; IconArray.Add(IconImageView); } var UnFullFactor = SmallRadius / this.Frame.Size.Height; CallbackIcon = new UIImageView(new CGRect((SmallButton.Frame.Size.Width - BigRadius) / 2, (SmallButton.Frame.Size.Height - BigRadius) / 2, BigRadius, BigRadius)); CallbackIcon.Layer.Transform = CATransform3D.MakeScale(UnFullFactor, UnFullFactor, 1.0f); CallbackIcon.Image = UIImage.FromBundle("CallbackSuccess"); CallbackIcon.Alpha = 0.0f; SmallButton.Add(CallbackIcon); CallbackMessage = new UILabel(); CallbackMessage.Text = @""; CallbackMessage.Alpha = 0.0f; CallbackMessage.Font = UIFont.SystemFontOfSize(20.0f); CallbackMessage.Layer.Transform = CATransform3D.MakeScale(UnFullFactor, UnFullFactor, 1.0f); CallbackMessage.TextColor = UIColor.White; //[UIColor whiteColor]; CallbackMessage.TextAlignment = UITextAlignment.Center; CallbackMessage.Frame = new CGRect((SmallButton.Frame.Size.Width - SmallRadius / 2) / 2, (SmallButton.Frame.Size.Height - SmallRadius / 4) / 2 + 6, SmallRadius / 2, SmallRadius / 4); SmallButton.Add(CallbackMessage); // FullPara = this.Frame.Size.Height / SmallRadius; var thning = SmallButton.Layer.ValueForKey(new NSString(@"transform.scale")); if (thning != null) { var val = (NSNumber)NSNumber.FromObject(thning); MidiumPara = val.DoubleValue; } else { MidiumPara = 1.0f; } SmallPara = 1.0f; }
public override void ViewDidLoad() { base.ViewDidLoad(); updateProfilePictureObserver = NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UpdateProfilePicture"), UpdateProfilePicture); updateUserNameObserver = NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UpdateUserName"), UpdateUserName); View.BackgroundColor = UIColor.FromRGB(33, 33, 33); var scrollView = new UIScrollView(new RectangleF(0, 0, (float)View.Frame.Width, (float)View.Frame.Height)); profileImageView = new UIImageView(new RectangleF(85, 20, 90, 90)); profileImageView.ContentMode = UIViewContentMode.ScaleAspectFill; profileImageView.Image = UIImage.FromBundle("Profile"); profileImageView.Layer.CornerRadius = (profileImageView.Frame.Width / 2); profileImageView.Layer.MasksToBounds = true; var tapGestureRecognizer = new UITapGestureRecognizer(this, new ObjCRuntime.Selector("TapProfilePictureSelector:")); profileImageView.AddGestureRecognizer(tapGestureRecognizer); profileImageView.UserInteractionEnabled = true; if (LoginController.userModel.profilePicturePath != null) { Utils.SetImageFromNSUrlSession(LoginController.userModel.profilePicturePath, profileImageView, this, PictureType.Profile); } var editProfileButtonImageView = new UIImageView(new RectangleF(220, 20, 24, 24)); editProfileButtonImageView.ContentMode = UIViewContentMode.ScaleAspectFill; editProfileButtonImageView.Image = UIImage.FromBundle("EditMenu"); editProfileButtonImageView.Layer.MasksToBounds = true; var tapGestureRecognizerEdit = new UITapGestureRecognizer(this, new ObjCRuntime.Selector("TapProfilePictureSelector:")); editProfileButtonImageView.AddGestureRecognizer(tapGestureRecognizerEdit); editProfileButtonImageView.UserInteractionEnabled = true; userName = new UILabel(new RectangleF(20, 120, 220, 20)); userName.Font = UIFont.SystemFontOfSize(14.0f); userName.TextAlignment = UITextAlignment.Center; userName.TextColor = UIColor.White; userName.Text = LoginController.userModel.name; var dividerLineView = new UIView(new RectangleF(20, 145, 220, 0.5f)); dividerLineView.BackgroundColor = UIColor.FromRGB(80, 80, 80); var pagesItems = new MenuPagesModel().MenuItems; var pagesTableView = new UITableView(new RectangleF(20, 150, 220, (pagesItems.Count * 40) - 10)); pagesTableView.ContentInset = new UIEdgeInsets(0, 20, 0, 0); pagesTableView.BackgroundColor = UIColor.Clear; pagesTableView.ScrollEnabled = false; new MenuTableViewController(pagesTableView, pagesItems, menuViewController); var dividerLineView2 = new UIView(new RectangleF(20, (float)pagesTableView.Frame.Y + (float)pagesTableView.Frame.Height + 15, 220, 0.5f)); dividerLineView2.BackgroundColor = UIColor.FromRGB(80, 80, 80); var filterLabel = new UILabel(new RectangleF(20, (float)dividerLineView2.Frame.Y + 5, 220, 20)); filterLabel.Font = UIFont.BoldSystemFontOfSize(12.0f); filterLabel.TextAlignment = UITextAlignment.Left; filterLabel.TextColor = UIColor.FromRGB(80, 80, 80); filterLabel.Text = "Filter"; var filterTipLabel = new UILabel(new RectangleF(20, (float)dividerLineView2.Frame.Y + 5, 220, 20)); filterTipLabel.Font = UIFont.BoldSystemFontOfSize(9.0f); filterTipLabel.TextAlignment = UITextAlignment.Right; filterTipLabel.TextColor = UIColor.FromRGB(196, 155, 9); filterTipLabel.Text = "You may select more than one"; var filterItems = new MenuFilterModel().MenuItems; var filterTableView = new UITableView(new RectangleF(26, (float)filterLabel.Frame.Y + 15, 214, filterItems.Count * 40)); filterTableView.ContentInset = new UIEdgeInsets(0, 14, 0, 0); filterTableView.SeparatorColor = UIColor.FromRGB(80, 80, 80); filterTableView.BackgroundColor = UIColor.Clear; filterTableView.ScrollEnabled = false; new MenuTableViewController(filterTableView, filterItems, menuViewController); var dividerLineView3 = new UIView(new RectangleF(20, (float)filterTableView.Frame.Y + (float)filterTableView.Frame.Height + 15, 220, 0.5f)); dividerLineView3.BackgroundColor = UIColor.FromRGB(80, 80, 80); #region Hashtag Menu //var dividerLineView3 = new UIView(new RectangleF(20, (float)filterTableView.Frame.Y + (float)filterTableView.Frame.Height + 25, 220, 0.5f)); //dividerLineView3.BackgroundColor = UIColor.Black; //var hashtagLabel = new UILabel(new RectangleF(20, (float)dividerLineView3.Frame.Y + 5, 220, 20)); //hashtagLabel.Font = UIFont.BoldSystemFontOfSize(12.0f); //hashtagLabel.TextAlignment = UITextAlignment.Left; //hashtagLabel.TextColor = UIColor.Black; //hashtagLabel.Text = "Hashtag"; //var hashtagText = new UITextField(new RectangleF(20, (float)hashtagLabel.Frame.Y + 30, 220, 40)); //hashtagText.BorderStyle = UITextBorderStyle.Bezel; //hashtagText.Placeholder = "inserts tags to filter here"; #endregion #region Logout Button var logoutModel = new MenuLogoutModel(); var logoutButton = new UIButton(new RectangleF(0, (float)dividerLineView3.Frame.Y + 5, (float)View.Frame.Width, 40)); //logoutButton.BackgroundColor = UIColor.FromRGB(50, 50, 50); logoutButton.TouchUpInside += (object sender, EventArgs e) => { CredentialsService.DeleteCredentials(); LoginController.tokenModel = null; LoginController.userModel = null; var loginController = menuViewController.Storyboard.InstantiateViewController("LoginNavController"); if (loginController != null) { menuViewController.PresentViewController(loginController, true, null); } }; var logoutIcoImageView = new UIImageView(); logoutIcoImageView.ContentMode = UIViewContentMode.ScaleAspectFit; logoutIcoImageView.Layer.MasksToBounds = true; logoutIcoImageView.TranslatesAutoresizingMaskIntoConstraints = false; logoutIcoImageView.Image = UIImage.FromBundle(logoutModel.ImageName); var logoutTitleLabel = new UILabel(); logoutTitleLabel.Font = UIFont.SystemFontOfSize(14); logoutTitleLabel.Text = logoutModel.Title; logoutTitleLabel.TextColor = UIColor.White; logoutTitleLabel.TranslatesAutoresizingMaskIntoConstraints = false; logoutButton.Add(logoutIcoImageView); logoutButton.Add(logoutTitleLabel); logoutButton.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-48-[v0(24)]-20-[v1]-8-|", new NSLayoutFormatOptions(), "v0", logoutIcoImageView, "v1", logoutTitleLabel)); logoutButton.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-8-[v0(24)]", new NSLayoutFormatOptions(), "v0", logoutIcoImageView)); logoutButton.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-10-[v0(24)]", new NSLayoutFormatOptions(), "v0", logoutTitleLabel)); #endregion scrollView.AddSubview(profileImageView); scrollView.AddSubview(userName); scrollView.AddSubview(editProfileButtonImageView); scrollView.AddSubview(dividerLineView); scrollView.AddSubview(pagesTableView); scrollView.AddSubview(dividerLineView2); scrollView.AddSubview(filterLabel); scrollView.AddSubview(filterTipLabel); scrollView.AddSubview(filterTableView); scrollView.AddSubview(dividerLineView3); #region Hashtag Menu //scrollView.Add(dividerLineView3); //scrollView.Add(hashtagLabel); //scrollView.Add(hashtagText); #endregion scrollView.AddSubview(logoutButton); var scrollHeight = 20 + profileImageView.Frame.Height + 10 + userName.Frame.Height + 25 + dividerLineView.Frame.Height + 5 + pagesTableView.Frame.Height + 15 + dividerLineView2.Frame.Height + 5 + filterLabel.Frame.Height + 10 + filterTableView.Frame.Height + 5 + dividerLineView3.Frame.Height + 5 + logoutButton.Frame.Height + 40; if (scrollHeight > View.Frame.Height) { scrollView.ContentSize = new CGSize(View.Frame.Width, scrollHeight); } else { scrollView.ContentSize = new CGSize(View.Frame.Width, View.Frame.Height); } View.AddSubview(scrollView); }