share Profile with square avatar

This commit is contained in:
nixzhu
2015-09-18 18:12:12 +08:00
parent c7ede6f2e0
commit e9bdcb0ffe
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -16,6 +16,11 @@ extension UIImage {
return self.largestCenteredSquareImage().resizeToTargetSize(CGSize(width: radius * 2, height: radius * 2)).roundImage()
}
func squareImageOfSize(size: CGFloat) -> UIImage {
let size = floor(size - Ruler.match(.iPhoneWidths(0.5, 0.5, 1.5)))
return self.largestCenteredSquareImage().resizeToTargetSize(CGSize(width: size, height: size))
}
func largestCenteredSquareImage() -> UIImage {
let scale = self.scale
@@ -573,7 +573,8 @@ class ProfileViewController: UIViewController {
avatarFileURL = NSFileManager.yepAvatarURLWithName(avatar.avatarFileName),
avatarFilePath = avatarFileURL.path,
image = UIImage(contentsOfFile: avatarFilePath) {
thumbnail = image.roundImageOfRadius(50)
//thumbnail = image.roundImageOfRadius(50)
thumbnail = image.squareImageOfSize(100)
}
}