UIView *view = [[UIView alloc]initWithFrame:CGRectMake(100,100,100,100)];
view.backgroundColor = [UIColor redColor];
view.layer.borderWidth = 1.0;
view.layer.borderColor = [UIColor blueColor].CGColor;
UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(-8, -10, 20, 20)];
image.image = [UIImage imageNamed:@"sample"];
[view addSubview:image];图像在视图中,但边界线是透明的···请告诉我如何解决此问题。
发布于 2015-10-15 20:03:10
尝试使用:
image.clipsToBounds = YES;发布于 2014-10-07 13:38:40
image.contentMode = UIViewContentModeScaleAspectFit;添加上面一行的code.Issue将会被解析。
https://stackoverflow.com/questions/26229085
复制相似问题