facebook - 在 Swift 中使 UIView 成为一个圆圈

标签 facebook swift uiview geometry

<分区>

我已经尝试用谷歌搜索我的问题,但似乎无法在任何地方找到任何东西! 基本上我有一个 UIView,一旦他们登录到我的应用程序,它就会检索用户 Facebook 照片。目前它是一个正方形,但我完全不知道如何将 UIView 变成一个圆形...... 任何帮助将不胜感激,我还在学习! -亚历克斯

这只是将它连接到 UIView..

@IBOutlet var profilePictureView : FBProfilePictureView!

这会将 View 设置为用户 FB 个人资料照片

profilePictureView.profileID = user.objectID

在 app delegate.swift 中

FBProfilePictureView.self

这就是所有代码,我将 UIView 的类设置为 FBProfilePictureView。

最佳答案

你可以试试这个

 profilePictureView.layer.cornerRadius = profilePictureView.frame.size.width/2
 profilePictureView.clipsToBounds = true

 profilePictureView.layer.borderColor = UIColor.whiteColor().CGColor
 profilePictureView.layer.borderWidth = 5.0

关于facebook - 在 Swift 中使 UIView 成为一个圆圈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28410187/

相关文章:

ios - CLLocationManager 在设备上不工作

swift - 使用 NSLocalNotification 进行多次提醒

swift - Ubuntu 14.04 中出现 "swift build"错误

iphone - 如何截取 View 的屏幕截图并通过电子邮件发送?

objective-c - 根据标签设置 UIImage

iphone - UIView 与 UIViewController

c# - 使用 Facebook 注销

android - 在 Facebook 审查之前,我有哪些 App 权限?

php - 错误 : Class 'Facebook\FacebookSession' not found with the facebook PHP SDK

javascript - 从 phonegap facebook 登录获取用户 ID