【发布时间】:2012-04-03 07:14:41
【问题描述】:
我正在使用 UIColor* clear = [UIColor blackColor]; [self.layer setBorderColor:[color CGColor]];
为图像设置边框。它正在添加边框,但是当我尝试将该图像旋转到 45 度、90 度等时,该边框开始变得模糊并且不再固定或笔直。无论我做什么,如何将边框像一条线一样固定..
【问题讨论】:
标签: iphone objective-c ios
我正在使用 UIColor* clear = [UIColor blackColor]; [self.layer setBorderColor:[color CGColor]];
为图像设置边框。它正在添加边框,但是当我尝试将该图像旋转到 45 度、90 度等时,该边框开始变得模糊并且不再固定或笔直。无论我做什么,如何将边框像一条线一样固定..
【问题讨论】:
标签: iphone objective-c ios
UIColor* clear = [UIColor blackColor]; [self.layer setBorderColor:[color CGColor]];
看起来很奇怪;\ 这里的 self 是什么? 尝试
UIImageView *imgView = [[UIImageView alloc] setImage:[UIImage imageNamed:@"pic.png"]];
[self.view addSubview:imgView];
imgView.layer.borderWidth = 2.0f;
imgView.layer.borderColor = [[UIColor blackColor] CGColor];
别忘了包含 QuartzCore 框架和#import <QuartzCore/QuartzCore.h>
【讨论】: