ios - 如何将 UILabel 放置在 UIImageView 下方,使其始终均匀放置

标签 ios objective-c uiimageview uilabel cgrectmake

我做了一个自定义的弹出 View ,看起来像这样

我想将用户名标签放在用户图像下方,用户图像是给定图像中的圆形 UIImageView

无论文本大小如何,我都希望用户名均匀放置。 就像我希望名字这样显示

enter image description here

最佳答案

  1. 将标签内容居中对齐。

  2. 设置从标签到 ImageView 的约束。将标签水平居中放置在 ImageView 中。

Align label horizontally to imageview

关于ios - 如何将 UILabel 放置在 UIImageView 下方,使其始终均匀放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39200261/

相关文章:

ios - CBCharacteristicProperties 是什么意思?

objective-c - iOS:自定义对象的 NSPredicate 作为属性

ios - UIImageView动画后如何清理内存

iOS在UICollectionview中根据Page定义Cell个数(Collectionview with Paging)

ios - 如何将完整数据写入 UIImage 到 NSOutputStream

ios - UICollectionViewCell 中异步加载图像导致标签消失

ios - 如何将一张图片放在另一张图片前面?

ios - 如何从 firebase 检索当前用户的数据

ios - 发送 iOS 用户更新 iOS 版本

ios - 无法调用 tableViewController