OGeek|极客世界-中国程序员成长平台

标题: ios - 如何将 facebook sdk 登录添加到 eureka swift 表单? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 16:44
标题: ios - 如何将 facebook sdk 登录添加到 eureka swift 表单?

我目前正在使用 Swift 开发一个 iOS 应用程序,我已经下载了 facebook sdk login 并且我很熟悉它。另一方面,我需要制作自定义表格 View ,因此我下载了 Eureka 框架来执行此操作。

我有一个表格,要求用户提供信息以注册新帐户,问题是我需要在表格 View 顶部有一个 facebook 登录选项,但我还没有找到实现此目的的方法。由于 Eureka TableView 是以编程方式添加的,因此可以在 Storyboard 中看到它,因此我需要找到一种方法并添加登录按钮。有谁知道如何做到这一点?谢谢

这是我的表格代码:

private func addLoginForm() {
        self.form +++ Section()
            <<< TextRow() { $0.placeholder = "Name"
                $0.tag = "name"
            }
            +++ Section()
            <<< TextRow() { $0.placeholder = "Email"
                $0.tag = "email"
            }
            +++ Section()
            <<< PhoneRow() {$0.placeholder = "hone"
                $0.tag = "phone"
            }
            +++ Section()
            <<< PasswordRow() { $0.placeholder = "assword"
                $0.tag = "password"
            }
            +++ Section()
            <<< ButtonRow() {
                $0.title = "Login"
                $0.onCellSelection { cell, row in

                    self.evaluate()

                    }.cellSetup({ (cell, row) in
                        cell.backgroundColor = UIColor(red: 114.0/255, green: 3.0/255, blue: 194.0/255, alpha: 1.0)
                        cell.tintColor = UIColor.whiteColor()
                        row.cell.height = {
                            return  65
                        }
                    })
        }

    }



Best Answer-推荐答案


我通过在一个部分的标题中添加 facebook 登录来创建解决方案,格式如下:

   form  +++ Section()
            {
                var header = HeaderFooterView<FBSDKLoginButton>(HeaderFooterProvider.Class)
                header.onSetupView = { (view: FBSDKLoginButton, section: Section) -> Void in
                     view.readPermissions = ["public_profile","email","user_friends"]
                     view.delegate = self
                }

                $0.header = header
        }

你还需要导入 FBSDKLoginKit 和 FBSDKCoreKit

关于ios - 如何将 facebook sdk 登录添加到 eureka swift 表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37476010/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) Powered by Discuz! X3.4