gpt4 book ai didi

ios - 让 UIImageView 充当 Facebook 登录按钮

转载 作者:行者123 更新时间:2023-11-30 13:13:11 26 4
gpt4 key购买 nike

在我的 main.storyboard 中,我有一个 UIImage View ,它只是一个通用的 Facebook 登录按钮。但是,我很困惑,因为使用这些通用步骤

override func viewDidLoad(){
{
super.viewDidLoad()
var imageView = <# imageView #>
let tapGestureRecognizer = UITapGestureRecognizer(target:self, action:Selector("imageTapped:"))
imageView.userInteractionEnabled = true
imageView.addGestureRecognizer(tapGestureRecognizer)
}

func imageTapped(img: AnyObject)
{
// The Action
}

我对这种情况下的操作有点迷茫,因为我需要通过 Facebook SDK 链接所有内容。

最佳答案

在您的图像中点击

func imageTapped() {
let manager = FBSDKLoginManager()
manager.logInWithReadPermissions(["public_profile"], fromViewController: self, handler: { result, error in
if error != nil {
print("process error")
} else if result.isCancelled {
print("cancelled log in")
} else {
print("logged in")
}
})
}

关于ios - 让 UIImageView 充当 Facebook 登录按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38518299/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com