Exemplo n.º 1
0
 public void GetOptimizelyCodeBlocksKey()
 {
     try
     {
         OptimizelyCodeBlocksKey.GetOptimizelyCodeBlocksKey("string", new NSObject [] {});
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message);
     }
     Assert.Pass();
 }
        public CodeBlocksViewController()
        {
            // [OPTIMIZELY] Example how to declare a code block
            OnboardingFunnel = OptimizelyCodeBlocksKey.GetOptimizelyCodeBlocksKey("OnboardingFunnel", new NSObject[] { new NSString("Add Onboarding Stage") });
            OptimizelyiOS.Optimizely.PreregisterBlockKey(OnboardingFunnel);

            View.BackgroundColor = Styling.Colors.BackgroundColor;

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

            var label = new UILabel
            {
                Text          = "A company that helps you buy widgets.",
                TextColor     = Styling.Colors.TextBlue,
                Font          = UIFont.FromName("Gotham-Light", 12),
                TextAlignment = UITextAlignment.Center
            };

            var button = new CustomButton
            {
                TitleText = "Sign In"
            };

            button.TouchUpInside += Button_TouchUpInside;

            View.AddSubviews(image, label, button);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                image.WithSameCenterX(View),
                image.WithSameTop(View).Plus(60),

                label.WithSameCenterX(View),
                label.Below(image).Plus(30),

                button.WithSameCenterX(View),
                button.WithSameBottom(View).Minus(150),
                button.Width().EqualTo(200),
                button.Height().EqualTo(50)
                );
        }