使用苹果登录按钮,苹果标志显示过小。

11

苹果徽标看起来很小。我在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)
}

这是该按钮的默认行为吗,还是我操作有误? 截图在这里

请检查您的本地化设置。 - Pooja Gupta
2个回答

1
我有完全相同的问题,苹果因此拒绝了我的应用程序,他们似乎不喜欢自己的按钮,这很令人沮丧。
最终我从以下网站下载了图标包:

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;
    }

通过以上操作,它没有显示苹果按钮。 - sejn

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
}

目前你的回答不够清晰,请编辑并添加更多细节,以帮助其他人理解它如何回答问题。你可以在帮助中心找到有关如何编写好答案的更多信息。 - Community

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接