我有一个 UIImageView 有一个图像。initWithFrame:(CGRect)frame
看起来像这样:
#define BORDER_WIDTH_SELECTION 3
#define SELECTED_SCALE_VALUE 1.3
self.layer.masksToBounds = NO;
smallFrame_ = frame;
float newX = self.center.x - ((self.frame.size.width*SELECTED_SCALE_VALUE)*0.5);
float newY = self.center.y - ((self.frame.size.height*SELECTED_SCALE_VALUE)*0.5);
bigFrame_ = CGRectMake(newX, newY, self.frame.size.width*SELECTED_SCALE_VALUE, self.frame.size.height*SELECTED_SCALE_VALUE);
self.layer.borderWidth = BORDER_WIDTH_SELECTION;
然后我触发这个
- (void) setSelected {
[self makeThumbnailBig];
self.layer.borderColor = [UIColor colorWithRed:178.0/255.0 green:19.0/255.0 blue:50.0/255.0 alpha:1.0].CGColor;
}
- (void)makeThumbnailBig
{
[UIView animateWithDuration:0.2 animations:^{
self.frame = bigFrame_;
}];
}
ImageView
正确缩放并绘制红色边框,但随后从左侧边框下方的峰值image
内ImageView
出现大约一两个像素。我已经删除了图像,但这应该让您对这个问题有所了解:
有任何想法吗?