当前位置: 首页>>代码示例>>C#>>正文


C# UILabel.WithSameCenterY方法代码示例

本文整理汇总了C#中UILabel.WithSameCenterY方法的典型用法代码示例。如果您正苦于以下问题:C# UILabel.WithSameCenterY方法的具体用法?C# UILabel.WithSameCenterY怎么用?C# UILabel.WithSameCenterY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UILabel的用法示例。


在下文中一共展示了UILabel.WithSameCenterY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadView

        public override void LoadView ()
        {
            base.LoadView ();

            isUserLogged = UserDefaults.BoolForKey (IsUserLoggedKey);
            isAppActive = UserDefaults.BoolForKey (AppActiveEntryKey);
            isAppOnBackground = UserDefaults.BoolForKey (AppBackgroundEntryKey);

            marginTop = (isUserLogged && isAppActive) ? 10f : 1f;
            height = (isUserLogged && isAppActive) ? 250f : 62f; // 4 x 60f(cells),

            var v = new UIView {
                BackgroundColor = UIColor.Clear,
                Frame = new CGRect (0,0, UIScreen.MainScreen.Bounds.Width, height),
            };

            v.Add (tableView = new UITableView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Clear,
                TableFooterView = new UIView(),
                ScrollEnabled = false,
                RowHeight = cellHeight,
            });

            v.Add (openAppView = new UIView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = true,
            });

            UIView bg;
            openAppView.Add (bg = new UIView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Black,
                Alpha = 0.1f,
            });

            UILabel textView;
            openAppView.Add (textView = new UILabel {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font = UIFont.FromName ("Helvetica", 13f),
                Text = isAppActive ? "NoLoggedUser".Tr() : "NoActiveApp".Tr(),
                TextColor = UIColor.White,
                BackgroundColor = UIColor.Clear,
            });

            openAppView.Add (openAppBtn = new StartStopBtn {
                TranslatesAutoresizingMaskIntoConstraints = false,
                IsActive = true,
            });

            openAppView.AddConstraints (

                bg.AtTopOf (openAppView),
                bg.AtLeftOf (openAppView),
                bg.AtRightOf (openAppView),
                bg.AtBottomOf (openAppView),

                textView.WithSameCenterY (openAppView),
                textView.AtLeftOf (openAppView, 50f),
                textView.WithSameHeight (openAppView),
                textView.AtRightOf (openAppView),

                openAppBtn.Width().EqualTo (35f),
                openAppBtn.Height().EqualTo (35f),
                openAppBtn.AtRightOf (openAppView, 15f),
                openAppBtn.WithSameCenterY (openAppView),

                null
            );

            v.AddConstraints (

                tableView.AtTopOf (v),
                tableView.WithSameWidth (v),
                tableView.Height().EqualTo (height - marginTop).SetPriority (UILayoutPriority.DefaultLow),
                tableView.AtBottomOf (v),

                openAppView.AtTopOf (v),
                openAppView.WithSameWidth (v),
                openAppView.Height().EqualTo (cellHeight),

                null
            );

            View = v;
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:86,代码来源:WidgetViewController.cs

示例2: VisualEditorViewController

        public VisualEditorViewController()
        {
            View.BackgroundColor = Styling.Colors.BackgroundColor;

              View.AddGestureRecognizer(new UITapGestureRecognizer(ViewTap));

              var discountLabel = new UILabel
              {
            BackgroundColor = Styling.Colors.Green,
            Text = "25% OFF YOUR FIRST ORDER IF YOU SIGN UP BY 9/1",
            Font = UIFont.FromName("Gotham-Medium", 11),
            TextColor = UIColor.White,
            TextAlignment = UITextAlignment.Center
              };

              var image = new UIImageView
              {
            Image = UIImage.FromBundle("Images/widgetCoLogo_red"),
              };

              var emailLabel = new UILabel
              {
            Text = "Email",
            Font = UIFont.FromName("Gotham-Light", 10)
              };
              var emailField = new CustomTextField
              {
            Placeholder = "[email protected]"
              };

              var phoneLabel = new UILabel
              {
            Text = "Phone Number:",
            Font = UIFont.FromName("Gotham-Light", 10)
              };

              var phoneField = new CustomTextField
              {
            Placeholder = "(555)-555-5555"
              };

              var passwordLabel = new UILabel
              {
            Text = "Password",
            Font = UIFont.FromName("Gotham-Light", 10)
              };

              var passwordField = new CustomTextField
              {
            SecureTextEntry = true,
              };

              var button = new CustomButton
              {
            TitleText = "Take me to the widgets"
              };

              View.AddSubviews(emailLabel, emailField, phoneLabel, phoneField, passwordLabel, passwordField, button, discountLabel, image);

              View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

              View.AddConstraints(
            discountLabel.WithSameTop(View),
            discountLabel.WithSameLeft(View),
            discountLabel.WithSameRight(View),
            discountLabel.Height().EqualTo(30),

            phoneLabel.WithSameLeft(phoneField),
            phoneLabel.WithSameCenterY(View),

            phoneField.WithSameCenterX(View),
            phoneField.Height().EqualTo(30),
            phoneField.Width().EqualTo(200),
            phoneField.Below(phoneLabel).Plus(5),

            emailField.WithSameLeft(phoneField),
            emailField.WithSameWidth(phoneField),
            emailField.WithSameHeight(phoneField),
            emailField.Above(phoneLabel).Minus(15),

            emailLabel.WithSameLeft(phoneField),
            emailLabel.Above(emailField).Minus(5),

            image.WithSameCenterX(View),
            image.Above(emailLabel).Minus(15),

            passwordLabel.WithSameLeft(phoneField),
            passwordLabel.Below(phoneField).Plus(15),

            passwordField.WithSameLeft(phoneField),
            passwordField.WithSameWidth(phoneField),
            passwordField.WithSameHeight(phoneField),
            passwordField.Below(passwordLabel).Plus(5),

            button.Below(passwordField).Plus(20),
            button.WithSameCenterX(View),
            button.WithSameWidth(phoneField),
            button.Height().EqualTo(50)
              );
        }
开发者ID:ahouhel,项目名称:XamarinBindings,代码行数:100,代码来源:VisualEditorViewController.cs


注:本文中的UILabel.WithSameCenterY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。