Is there a nine-patch loader for iPhone?

后端 未结 4 2029
小蘑菇
小蘑菇 2020-12-22 22:19

Android has a nice way of defining stretchable images called a nine-patch. See these docs for a description of the concept. The idea is to surround a png image with a 1-pi

4条回答
  •  情深已故
    2020-12-22 22:43

    All UIImage images support this natively. By default the entire images is stretchable, but you can set caps with the leftCapWidth and topCapHeight properties or you can generate one from an existing UIImage with the - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight method.

    Do note that in apple's implementation, when you set one or both of these values, the stretchable area is forced to be a single pixel high/wide.

提交回复
热议问题