11

Apple 标志显得很小。我给 xib 中的 appleSignView 提供了 44px 的高度。

我正在使用的代码:

private func setupAppleSignIn() {
   let button = ASAuthorizationAppleIDButton(authorizationButtonType: .signIn, authorizationButtonStyle: .white)
   rootView.appleSignView.isHidden = false
   button.frame = rootView.appleSignView.bounds
   print(button.frame)
   rootView.appleSignView.addSubview(button)
   button.addTarget(self, action: #selector(handleAuthorizationAppleIDButtonPress), for: .touchUpInside)
}

这是该按钮的默认行为还是我做错了什么? 截图在这里

4

2 回答 2

1

我有完全相同的问题,Apple 拒绝了我的应用程序,他们似乎不喜欢他们自己的按钮,这很可悲。

我最终从以下位置下载了图标包:

https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/

并创建了我自己的图标,如下所示:

    if (@available(iOS 13.0, *))
    {
        self.appleIDButton = [[UIButton alloc] initWithFrame:CGRectMake(x,
                                                                       y,
                                                                       44,
                                                                       44)];
        UIImage *appleButtonImage = [UIImage imageNamed:@"appleLogin.png"];
        [self.appleIDButton setImage:appleButtonImage forState:UIControlStateNormal];
        [self.appleIDButton addTarget:self action:@selector(handleAuthrization:) forControlEvents:UIControlEventTouchUpInside];
        self.appleIDButton.layer.borderColor = [UIColor whiteColor].CGColor;
        self.appleIDButton.layer.borderWidth = 0.5f;
        self.appleIDButton.layer.cornerRadius = 10.0f;
        self.appleIDButton.layer.masksToBounds = YES;
    }
于 2020-08-12T23:06:17.840 回答
0
 func setupSignInButton() {
    
    let button = ASAuthorizationAppleIDButton()
    button.addTarget(self, action: #selector(handleSignInWithAppleTapped), for: .touchUpInside)
    view.addSubview(button)
    button.cornerRadius = 10
    button.translatesAutoresizingMaskIntoConstraints = false
    button.heightAnchor.constraint(equalToConstant: 40).isActive = true
    button.widthAnchor.constraint(equalToConstant: 200).isActive = true
    button.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    button.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -350).isActive = true
}
于 2022-01-24T22:33:19.247 回答