我尝试使用layer.borderColor
和CGContextSetStrokeColorWithColor
在非方形png图像周围添加边框,但这导致图像周围的方形边框不在真实图像周围。
有没有办法做到这一点 ?
最佳答案
如果要舍入的ImageView。
UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@""]];
imageView.layer.borderColor = [UIColor blackColor].CGColor; // Apply Color of your choice
imageView.layer.borderWidth = 2.0; // Apply width of your choice
imageView.layer.cornerRadius = 50; // Apply radius of your choice
imageView.clipsToBounds = YES;
关于ios - 为非方形UIImage添加边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28136230/