Exemplo n.º 1
0
        void SetupProviderLoginView()
        {
            var authorizationButton = new ASAuthorizationAppleIdButton(ASAuthorizationAppleIdButtonType.Default, ASAuthorizationAppleIdButtonStyle.White);

            authorizationButton.TouchUpInside += HandleAuthorizationAppleIDButtonPress;
            loginProviderStackView.AddArrangedSubview(authorizationButton);
        }
Exemplo n.º 2
0
        private void AddSignInWithAppleButton()
        {
            var authorizationButton = new ASAuthorizationAppleIdButton(
                ASAuthorizationAppleIdButtonType.Default,
                ASAuthorizationAppleIdButtonStyle.White);

            authorizationButton.CornerRadius   = 20;
            authorizationButton.TouchUpInside += OnTouchUpInsideAppleIdButton;

            loginProviderStackView.AddArrangedSubview(authorizationButton);
        }
Exemplo n.º 3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            View.BackgroundColor = UIColor.White;

            var button = new ASAuthorizationAppleIdButton(
                ASAuthorizationAppleIdButtonType.SignIn,
                ASAuthorizationAppleIdButtonStyle.Black);

            button.TouchUpInside += delegate { SignInWithAppl(); };

            View.FillWith(button, 200, 500);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <AppleSignInButton> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                // Cleanup
                if (Is13)
                {
                    if (button != null)
                    {
                        button.TouchUpInside -= Button_TouchUpInside;
                    }
                }
                else
                {
                    if (oldButton != null)
                    {
                        oldButton.TouchUpInside -= Button_TouchUpInside;
                    }
                }
            }

            if (e.NewElement != null)
            {
                // Create
                if (Is13)
                {
                    if (button == null)
                    {
                        button = (ASAuthorizationAppleIdButton)CreateNativeControl();
                        button.TouchUpInside += Button_TouchUpInside;

                        SetNativeControl(button);
                    }
                }
                else
                {
                    if (oldButton == null)
                    {
                        oldButton = (UIButton)CreateNativeControl();
                        oldButton.TouchUpInside     += Button_TouchUpInside;
                        oldButton.Layer.CornerRadius = 4;
                        oldButton.Layer.BorderWidth  = 1;
                        oldButton.ClipsToBounds      = true;
                        oldButton.SetTitle(" " + Element.Text, UIControlState.Normal);

                        switch (Element.ButtonStyle)
                        {
                        case AppleSignInButtonStyle.Black:
                            oldButton.BackgroundColor = UIColor.Black;
                            oldButton.SetTitleColor(UIColor.White, UIControlState.Normal);
                            oldButton.Layer.BorderColor = UIColor.Black.CGColor;
                            break;

                        case AppleSignInButtonStyle.White:
                            oldButton.BackgroundColor = UIColor.White;
                            oldButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
                            oldButton.Layer.BorderColor = UIColor.White.CGColor;
                            break;

                        case AppleSignInButtonStyle.WhiteOutline:
                            oldButton.BackgroundColor = UIColor.White;
                            oldButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
                            oldButton.Layer.BorderColor = UIColor.Black.CGColor;
                            break;
                        }

                        SetNativeControl(oldButton);
                    }
                }
            }
        }