gpt4 book ai didi

ios - 使 UIImageView 图像稍微变小

转载 作者:行者123 更新时间:2023-11-29 12:19:04 24 4
gpt4 key购买 nike

我想让我在 UIImageView 中的图像比最初为我设置的图像略小。

我已经将 contentMode 发送到 UIViewContentModeScaleAspectFill,但我仍然想让它稍微小一些。

self.imgCamera.layer.cornerRadius = self.imgCamera.frame.size.width / 2;
self.imgCamera.contentMode=UIViewContentModeScaleAspectFill;
self.imgCamera.clipsToBounds = YES;

最佳答案

假设 Storyboard中的导出是

@property (weak, nonatomic) IBOutlet UIImageView *imageView;

在您的代码中,使用它来制作 UIImageView 的“填充”,这应该会为您提供图像尺寸小于框架的结果。

imageView.bounds = CGRectInset(imageView.frame, 10.0f, 10.0f);

关于ios - 使 UIImageView 图像稍微变小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31197595/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com