ios - 圆形框架 iOS 中的图像

标签 ios objective-c xcode uiimageview uiimage

<分区>

我有一个带有联系人列表的 uitableview。我想在小牛队的登录屏幕中将每个联系人的图像放在一个圆框中。关于如何在 uitableviewCell 中执行此操作的任何建议?

enter image description here

最佳答案

我假设您的 Cell 中有 imageView,因此您只需使用不可见的边框即可获得相同的效果。使用此代码实现此效果:

cell.yourImageView.layer.cornerRadius = cell.yourImageView.frame.size.height /2;
cell.yourImageView.layer.masksToBounds = YES;
cell.yourImageView.layer.borderWidth = 0;

您的 UIImageView 必须具有相同的高度和宽度,并且您必须在您的项目中导入 quartzCore 框架

关于ios - 圆形框架 iOS 中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19640766/

相关文章:

ios - 在 Swift4 中,替换 navigationItem.leftBarButtonItem 会调整不需要的大小

objective-c - 使用 ARC 返回自动释放的 CFTypeRef

ios - iOS 6 自动布局问题

iphone - 在 iOS 中的触摸点区域设置图像模糊效果

objective-c - didSelectRowAtIndexPath 一次选择多行

ios - 如何处理通用 Storyboard上的长文本标签?

iphone - 在 XCode 中模拟加速度计、麦克风和摄像头

ios - iAd 网络错误 - 暂时不可用

iOS:使用哪种增强现实 SDK 用于虚拟试衣间?

ios - 核心数据警告 : Unrecognized optimized model archive format