swift - 如何在 UITableViewCell 中显示 FBSDKLoginButton?

标签 swift uitableview ios8 xcode6 facebook-sdk-4.0

如何将我的 FBSDKLoginButton 正确显示到我的 UITableViewCell。我没有足够的声誉来发布图片所以 here's the link to my screenshot .

正如您从我的屏幕截图中看到的那样,注销按钮被部分隐藏了。这是我的 tableView:cellForRowAtIndexPath 函数的代码片段:

if indexPath.row == 4 { //LOGOUT
        fbLoginButton.readPermissions = ["public_profile"]
        fbLoginButton.delegate = self
        fbLoginButton.center = myCell.contentView.center
        myCell.contentView.addSubview(fbLoginButton)
        myCell.accessoryType = UITableViewCellAccessoryType.None
        myCell.selectionStyle = UITableViewCellSelectionStyle.None
}

最佳答案

我能够通过这段代码正确显示 facebook 注销按钮:

if indexPath.row == 4 { //LOGOUT
        fbLoginButton.delegate = self
        fbLoginButton.center = CGPointMake(tableView.bounds.width/2, fbLoginButton.bounds.height / 1.4)
        myCell.addSubview(fbLoginButton)
        myCell.accessoryType = UITableViewCellAccessoryType.None
        myCell.selectionStyle = UITableViewCellSelectionStyle.None
}

我不知道这是否正确,但它对我有用。我现在的截图looks like this .

关于swift - 如何在 UITableViewCell 中显示 FBSDKLoginButton?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31378719/

相关文章:

swift - 为什么我在进行可选链接时会出错?

swift - AVFoundation:使用 AVAudioEngine 和 AVAudioFile 的格式错误的 .m4a 文件格式

ios - 将参数传递给 dispatch_async

ios - UITapGestureRecognizer 在 UIImageView 上工作,但不在 UILabel 上工作

ios - InsertRowsAtIndexPaths 错误 swift

ios - View 框架在运行时不遵守约束

ios - iOS8 beta 5 上的 UIWebView 中的定位服务无法正常工作

ios - Swift iOS 中的 GMSCircle 不规则边框

ios - 如何添加占位符?

ios - MVVM 与 RxSwift