ios - 如何正确裁剪个人资料照片?

标签 ios swift uiimageview crop

我允许用户选择他们的个人资料图片,但是当我导入它并剪切边框并使其变圆时,它看起来很奇怪。有没有正确的方法来做到这一点?

propic.layer.borderWidth = 2
propic.layer.masksToBounds = false
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.clipsToBounds = true

最佳答案

试试这个

propic.layer.borderWidth = 2
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.layer.masksToBounds = true

关于ios - 如何正确裁剪个人资料照片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37259371/

相关文章:

iOS 10 Collection View :prefetchItemsAt not called

objective-c - iOS 异常 EXC_GUARD

ios - 根据字符串数组中字符串的字符计数以一定时间间隔更改标签文本

swift - 在 Xcode 8.0 Swift 3.0 上的接口(interface) Controller 之间传递数据

swift - 如何在 iOS Swift 中使用 alamofire 登录后传递 JWT token ?

ios - 如何在 App Store 应用程序的标签栏中同时使用实体和轮廓图标?

ios - “调整”我当前的 UISwipeGestureRecognizer 代码,使用 UIPanGestureRecognizer 将图像轻弹到 iPhoto 样式

ios - Objective C 在图像上设置中心

ios - 下载的图像尺寸比想要的尺寸大

ios - 部分错误 Swift 中的行数