图像视图框架不适合实际大小



我已经在故事板上创建了一个imageView,并在其上创建了一些约束。然后,我使用函数在该图像视图中添加边框:

CALayer *borderLayer = [CALayer layer];
CGRect borderFrame = CGRectMake(0, 0, (imageView.frame.size.width), (imageView.frame.size.height));
//Make some changes in the border
[borderLayer setFrame:borderFrame];
[imageView.layer addSublayer:borderLayer];

事实是,当我运行应用程序时,边框小于图像。我想它一定是比例尺之类的东西,但我可以弄清楚。感谢您的帮助!

如何直接操纵图像层的寄宿器属性?

imageView.layer.borderWidth = 7.0;

最新更新