Tag: 图层

如何对图像进行透视三维变换并将该图像保存在文档目录中

我正在按照代码在图像层上应用3D变换。 UIImageView *view = (UIImageView *)[recognizer view]; CGPoint translation = [recognizer translationInView:self.view]; CGPoint newCenter = view.center; newCenter.x += translation.x; newCenter.y += translation.y; view.center = newCenter; [recognizer setTranslation:CGPointZero inView:self.view]; 以下是从哪些点转换到转换。 UIView的+四边形 [self.view transformToFitQuadTopLeft:self.topLeftControl.center topRight:self.topRightControl.center bottomLeft:self.bottomLeftControl.center bottomRight:self.bottomRightControl.center]; 为了将转换图像保存到UIImage我已经使用renderInContext下面的代码。 UIGraphicsBeginImageContext(view.frame.size); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); 第二个使用drawViewHierarchyInRect UIGraphicsBeginImageContextWithOptions(self.toothImageView_1.bounds.size, NO, 0); BOOL ok = [self.toothImageView_1 drawViewHierarchyInRect:self.toothImageView_1.bounds afterScreenUpdates:YES]; UIImage […]

如果我使用圆形图像,ImageView中不显示图像

我有一个表视图,我需要在部分标题中显示author_img。 在ViewForSectionHeader方法中,我想使图像成为圆形。 但是如果我这样做,不pipe是在模拟器还是在真实的设备上,图像都不会显示出来。 如果我删除代码,uiimageview将正常显示图像。 我为uiimageview设置了宽度和高度约束,因为我想获得固定大小的显示图像。 那么有什么想法吗? cell.author_img.layer.cornerRadius = cell.author_img.frame.size.width/2 cell.author_img.layer.masksToBounds = true // add a boundary for thumb cell.author_img.layer.borderWidth = 1.5 cell.author_img.layer.borderColor = UIColor.whiteColor().CGColor