我最近从使用PaintCode 2切换到PaintCode 3,我将它与xCode / Swift一起使用。
然而,我注意到,我的所有图像生成功能都没有不同的表现。它们接缝到标准的addopt cap insets。作为下面的示例,您可以找到一个画布" ViewMissingImage",以及它在PaintCode中的配置方式(2或3其相同)。
通过PaintCode 2生成的代码
public class func imageOfViewMissingImage(frame frame: CGRect = CGRect(x: 6, y: 5, width: 109, height: 109)) -> UIImage {
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0)
PaintCode.drawViewMissingImage(frame: CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height))
let imageOfViewMissingImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return imageOfViewMissingImage
}
通过PaintCode 3生成的代码
public dynamic class func imageOfViewMissingImage(imageSize imageSize: CGSize = CGSize(width: 109, height: 109)) -> UIImage {
UIGraphicsBeginImageContextWithOptions(imageSize, false, 0)
PaintCode.drawViewMissingImage(frame: CGRect(x: 0, y: 0, width: imageSize.width, height: imageSize.height))
let imageOfViewMissingImage = UIGraphicsGetImageFromCurrentImageContext()!.resizableImageWithCapInsets(UIEdgeInsetsZero, resizingMode: .Tile)
UIGraphicsEndImageContext()
return imageOfViewMissingImage
}
我认为PaintCode 2从未使用过capp insets,也许这是一个bug? 我不想要这些上限,我怎么能摆脱它们呢?
答案 0 :(得分:1)
解决方案很简单:
将Cap Inset放在" Stretch"而不是PaintCode UI中的tile!