Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想拍一张这样的照片:
我写了代码:
[[[UIImage imageNamed:@"background.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(1.f, 1.f, 1.f, 1.f)] drawInRect:rect];
但是有了这段代码,我认为:
为什么???如何在四边固定 1px 的矩形中绘制调整大小的图像?
使用以下代码在 iOS 6+ 上拉伸图像:
[[[UIImage imageNamed:@"background.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(1.f, 1.f, 1.f, 1.f) resizingMode:UIImageResizingModeStretch]drawInRect:rect];