I have tried Googling my problem but cannot seem to find anything anywhere! Basically I have a UIView which retrieves a Users Facebook Photo once they log into my app. At the moment it is a square, but I cannot figure out at all how to turn the UIView into a circle... Any help would be greatly appreciated, I am still learning! -Alex
This Just connects it to the UIView..
@IBOutlet var profilePictureView : FBProfilePictureView!
This sets the View as the Users FB Profile Photo
profilePictureView.profileID = user.objectID
And in app delegate.swift
FBProfilePictureView.self
Thats all the code, I set the UIView's class to be FBProfilePictureView.
You can try this
profilePictureView.layer.cornerRadius = profilePictureView.frame.size.width/2
profilePictureView.clipsToBounds = true
profilePictureView.layer.borderColor = UIColor.whiteColor().CGColor
profilePictureView.layer.borderWidth = 5.0
Try defining a UIBezier path as a circle and then add it as a clip to your view:
let circle = UIBezierPath(arcCenter: (CGPoint), radius: (CGFloat), startAngle: 0, endAngle: 2*M_PI)
double check, but I think arcCenter is in your superview's co-ordinate system.
To add it as a clipping path, I think it's just: (You'll have to check the docs for details):
circle.addClip()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With