SDImage9PatchPNGCoder

Parse Nine Patch chunk in the PNG file.


License
MIT
Install
pod try SDImage9PatchPNGCoder

Documentation

SDImage9PatchPNGCoder

[![CI Status](https://img.shields.io/travis/Captain Black/SDImage9PatchPNGCoder.svg?style=flat)](https://travis-ci.org/Captain Black/SDImage9PatchPNGCoder) Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

SDImage9PatchPNGCoder is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SDImage9PatchPNGCoder'

Usage

  1. Remove SDImageAPNGCoder and add SDImage9PatchPNGCoder instead,
[SDImageCodersManager.sharedManager removeCoder:SDImageAPNGCoder.sharedCoder];
id<SDImageCoder> coder = [SDImage9PatchPNGCoder sharedCoder];
[SDImageCodersManager.sharedManager addCoder:coder];
  1. Read the UIImage proptery sd_extendedObject.
__weak typeof(self) wself = self;
[SDWebImageManager.sharedManager loadImageWithURL:url
											options:0
											context:nil
											progress:nil
											completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
		__strong typeof(wself) self = wself;
		NSDictionary* dic = (NSDictionary*)image.sd_extendedObject;
		NSValue* value = dic[@"padding"];
		UIEdgeInsets insets = [value UIEdgeInsetsValue];
		image = [image resizableImageWithCapInsets:insets
									resizingMode:UIImageResizingModeStretch];
		self.chatBubbleImageView.image = image;
}];

Author

Captain Black, captainblack.soul@gmail.com

License

SDImage9PatchPNGCoder is available under the MIT license. See the LICENSE file for more info.