Github Demo:
https://github.com/KenLuChinese/NinePointImage#ninepointimage
icon
UIImageView *imageView = [[UIImageView alloc] init];
UIImage *pointImage = [UIImage imageNamed:@"nine_point"];
CGFloat imageWidth = pointImage.size.width;
CGFloat imageHeight = pointImage.size.height;
/// 四个内边距合成中间的方形,方形区域向四方拉伸
UIEdgeInsets insets = UIEdgeInsetsMake(imageHeight*0.5, imageWidth*0.5, imageHeight*0.5-1, imageWidth*0.5-1);
/// 主要方法
pointImage = [pointImage resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
imageView.image = self.pointImage;