Is there a nine-patch loader for iPhone?

后端 未结 4 1914
小蘑菇
小蘑菇 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:50

    I received an e-mail from Tortuga22 software who informed me that they have created such a library and released it under the Apache license:

    Announcement: http://blog.tortuga22.com/2010/05/31/announcing-tortuga-22-ninepatch/

    Source code: http://github.com/tortuga22/Tortuga22-NinePatch

    Example usage:

    // loads-and-caches ninepatch and rendered image of requested size
    UIImage buttonImg = [TUNinePatchCache imageOfSize:buttonSize 
                                    forNinePatchNamed:@"buttonNormalBackground"];
    [self.buttonNeedingBackground setImage:buttonImg
                           forControlState:UIControlStateNormal];
    

提交回复
热议问题