diff --git a/Classes/LinphoneUI/UIRoundedImageView.m b/Classes/LinphoneUI/UIRoundedImageView.m index 100944f78..b3e7ce8a3 100644 --- a/Classes/LinphoneUI/UIRoundedImageView.m +++ b/Classes/LinphoneUI/UIRoundedImageView.m @@ -31,10 +31,19 @@ - (void)setRoundRadius:(BOOL)radius { CALayer *imageLayer = self.layer; + CGRect frame = imageLayer.frame; CGFloat height =self.frame.size.height; - CGFloat witdh = self.frame.size.width; - CGFloat roundRadius = height > witdh ? witdh / 2 : height / 2; + CGFloat width = self.frame.size.width; + CGFloat roundRadius = height > width ? width / 2 : height / 2; + if (height > width) { + frame.origin.y = height / 2 - width / 2; + frame.size.height = width; + } else { + frame.origin.x = width / 2 - height / 2; + frame.size.width = height; + } + [imageLayer setFrame:frame]; [imageLayer setCornerRadius:roundRadius]; [imageLayer setBorderWidth:0]; [imageLayer setMasksToBounds:YES]; diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 49b6d1938..4d8a483e4 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -122,6 +122,7 @@ 639CEB061A1DF4F1004DE38F /* UIChatRoomCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 639CEB081A1DF4F1004DE38F /* UIChatRoomCell.xib */; }; 639CEB091A1DF4FA004DE38F /* UIChatCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 639CEB0B1A1DF4FA004DE38F /* UIChatCell.xib */; }; 63CD4B4F1A5AAC8C00B84282 /* DTAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63CD4B4E1A5AAC8C00B84282 /* DTAlertView.m */; }; + 63FB30351A680E73008CA393 /* UIRoundedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FB30341A680E73008CA393 /* UIRoundedImageView.m */; }; 70571E1A13FABCB000CDD3C2 /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 70571E1913FABCB000CDD3C2 /* rootca.pem */; }; 7066FC0C13E830E400EFC6DC /* libvpx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7066FC0B13E830E400EFC6DC /* libvpx.a */; }; 70E542F313E147E3002BA2C0 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70E542F213E147E3002BA2C0 /* OpenGLES.framework */; }; @@ -976,6 +977,8 @@ 63CD4B4D1A5AAC8C00B84282 /* DTAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTAlertView.h; sourceTree = ""; }; 63CD4B4E1A5AAC8C00B84282 /* DTAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTAlertView.m; sourceTree = ""; }; 63EF7FDC1A24B5810017A416 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/AboutViewController.strings; sourceTree = ""; }; + 63FB30331A680E73008CA393 /* UIRoundedImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRoundedImageView.h; sourceTree = ""; }; + 63FB30341A680E73008CA393 /* UIRoundedImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIRoundedImageView.m; sourceTree = ""; }; 70571E1913FABCB000CDD3C2 /* rootca.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rootca.pem; path = "liblinphone-sdk/apple-darwin/share/linphone/rootca.pem"; sourceTree = ""; }; 7066FC0B13E830E400EFC6DC /* libvpx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvpx.a; path = "liblinphone-sdk/apple-darwin/lib/libvpx.a"; sourceTree = ""; }; 70E542F213E147E3002BA2C0 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; @@ -2066,6 +2069,8 @@ 2214EBF212F86360002A5394 /* UIMicroButton.m */, D36FB2D31589EF7C0036F6F2 /* UIPauseButton.h */, D36FB2D41589EF7C0036F6F2 /* UIPauseButton.m */, + 63FB30331A680E73008CA393 /* UIRoundedImageView.h */, + 63FB30341A680E73008CA393 /* UIRoundedImageView.m */, 22968A5D12F875C600588287 /* UISpeakerButton.h */, 22968A5E12F875C600588287 /* UISpeakerButton.m */, D354981E1587716B000081D8 /* UIStateBar.h */, @@ -3792,6 +3797,7 @@ D378906515AC373B00BD776C /* ContactDetailsLabelViewController.m in Sources */, D3E8F68615ADE05B0065A226 /* UIContactDetailsFooter.m in Sources */, C90FAA7915AF54E6002091CB /* HistoryDetailsViewController.m in Sources */, + 63FB30351A680E73008CA393 /* UIRoundedImageView.m in Sources */, F066515517F9A02E0064280C /* UITransparentTVCell.m in Sources */, D3F9A9EE15AF277E0045320F /* UACellBackgroundView.m in Sources */, D35860D615B549B500513429 /* Utils.m in Sources */,