简体   繁体   English

CALayer边界在旋转时变得模糊

[英]CALayer border get fuzzy on rotation

I am using UIColor* clear = [UIColor blackColor]; 我正在使用UIColor * clear = [UIColor blackColor]; [self.layer setBorderColor:[color CGColor]]; [self.layer setBorderColor:[color CGColor]];

to set the border for an image.It is adding border but when i tried rotating that image to 45 degree,90 degree so on ,that border starts getting fuzzy and its not fixed or straight anymore. 为图像设置边框。它正在添加边框,但是当我尝试将该图像旋转到45度,90度等时,该边框开始变得模糊并且不再固定或变为直线。 How can image that border fix like a line always whatever i do.. 无论我做什么,怎么都可以像边界一样固定边界图像。

UIColor* clear = [UIColor blackColor]; [self.layer setBorderColor:[color CGColor]];

looks like something weird ;\\ what is self here? 看起来很奇怪; \\这里的自我是什么? try to 尝试

UIImageView *imgView = [[UIImageView alloc] setImage:[UIImage imageNamed:@"pic.png"]];
[self.view addSubview:imgView];
imgView.layer.borderWidth = 2.0f;
imgView.layer.borderColor = [[UIColor blackColor] CGColor];

And don't forget to include QuartzCore framework and #import <QuartzCore/QuartzCore.h> 并且不要忘记包含QuartzCore框架和#import <QuartzCore/QuartzCore.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM