如何在ios中设置上边框/分隔线?

use*_*603 5 label border objective-c line imageview

我有一个imageview和一个标签,我想在它们之间有一个边框,最好的方法是什么?

我知道以下代码在整个imageView周围创建了一个边框:

[imageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];
Run Code Online (Sandbox Code Playgroud)

但我只想在它下面划一条线,而不是整条线.

Ayu*_*ush 5

只需添加一个UILabel背景色为黑色(假设你的边框颜色为黑色)和高度你们之间1px的的UIImageViewUILabel这将是简单得多.