diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/README.md b/README.md new file mode 100644 index 0000000..45ca5b8 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +UIImageView+Extension ![Supported Platforms](https://img.shields.io/cocoapods/p/UIImageView+Extension.svg) [![Latest pod release](https://img.shields.io/cocoapods/v/UIImageView+Extension.svg)](https://cocoapods.org/pods/UIImageView+Extension) [![Build Status](https://travis-ci.org/alexandreos/UILabel-Copyable.svg?branch=master)]() [![License](https://img.shields.io/cocoapods/l/UIImageView+Extension.svg)](https://github.com/lm2343635/UIImageView-Extension/LICENSE) +=== +A simple UIImageView category with some extension functions. + +# Features +- Supports Interface Builder. +- Set border radius for image view. +- Set shadow for image view. + +# Installation + +### CocoaPods +Installing UIImageView+Extension by [CocoaPods](http://cocoapods.org/). + +```ruby +pod 'UILabel+Copyable', '~> 1.0.0' +``` +### Old-fashioned way + +- Add `UIImageView+Extension.h` and `UIImageView+Extension.m` to your project. +- `#import "UIImageView+Extension.h"` where you want to use the control. +- These files require **ARC**. + +# Usage + +If you just want to set features in Interface Builder, just do it in Interface Builder, you need not to do anything. +![Interface Builder Guide](https://github.com/raw/lm2343635/UIImageView-Extension/master/Screenshoots/InterfaceBuilderGuide.png) +If you want to control your image view in your program, you should import the category header: `#import "UIImageView+Extension.h"` to your `.h` or `.m` file. diff --git a/Screenshoots/InterfaceBuilderGuide.png b/Screenshoots/InterfaceBuilderGuide.png new file mode 100644 index 0000000..2803872 Binary files /dev/null and b/Screenshoots/InterfaceBuilderGuide.png differ diff --git a/UIImageView+Extension Demo.xcodeproj/project.pbxproj b/UIImageView+Extension Demo.xcodeproj/project.pbxproj index 5097a1f..c6c80a2 100644 --- a/UIImageView+Extension Demo.xcodeproj/project.pbxproj +++ b/UIImageView+Extension Demo.xcodeproj/project.pbxproj @@ -16,8 +16,10 @@ E443BD141E2769B9006140E8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E443BD121E2769B9006140E8 /* LaunchScreen.storyboard */; }; E443BD1F1E2769BA006140E8 /* UIImageView_Extension_DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E443BD1E1E2769BA006140E8 /* UIImageView_Extension_DemoTests.m */; }; E443BD3D1E276ABD006140E8 /* UIImageView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = E443BD3C1E276ABD006140E8 /* UIImageView+Extension.m */; }; + E4CA26001E27CC0A007D51C8 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = E4CA25FF1E27CC0A007D51C8 /* README.md */; }; + E4CA26021E27D294007D51C8 /* Screenshoots in Resources */ = {isa = PBXBuildFile; fileRef = E4CA26011E27D294007D51C8 /* Screenshoots */; }; E4E1C6F11E278FCC00A62D66 /* UIImageView+Extension.podspec in Resources */ = {isa = PBXBuildFile; fileRef = E4E1C6F01E278FCC00A62D66 /* UIImageView+Extension.podspec */; }; - E4E1C6F31E278FFF00A62D66 /* LICENSE.md in Resources */ = {isa = PBXBuildFile; fileRef = E4E1C6F21E278FFF00A62D66 /* LICENSE.md */; }; + E4E1C6F31E278FFF00A62D66 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = E4E1C6F21E278FFF00A62D66 /* LICENSE */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -47,8 +49,10 @@ E443BD201E2769BA006140E8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E443BD3B1E276ABD006140E8 /* UIImageView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+Extension.h"; sourceTree = ""; }; E443BD3C1E276ABD006140E8 /* UIImageView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+Extension.m"; sourceTree = ""; }; + E4CA25FF1E27CC0A007D51C8 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + E4CA26011E27D294007D51C8 /* Screenshoots */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Screenshoots; sourceTree = ""; }; E4E1C6F01E278FCC00A62D66 /* UIImageView+Extension.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UIImageView+Extension.podspec"; sourceTree = ""; }; - E4E1C6F21E278FFF00A62D66 /* LICENSE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = ""; }; + E4E1C6F21E278FFF00A62D66 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -72,6 +76,7 @@ E443BCF81E2769B9006140E8 = { isa = PBXGroup; children = ( + E4CA26011E27D294007D51C8 /* Screenshoots */, E4E1C6EF1E278F9900A62D66 /* Podspec */, E443BD281E2769BA006140E8 /* UIImageView+Extension */, E443BD031E2769B9006140E8 /* UIImageView+Extension Demo */, @@ -135,7 +140,8 @@ E4E1C6EF1E278F9900A62D66 /* Podspec */ = { isa = PBXGroup; children = ( - E4E1C6F21E278FFF00A62D66 /* LICENSE.md */, + E4E1C6F21E278FFF00A62D66 /* LICENSE */, + E4CA25FF1E27CC0A007D51C8 /* README.md */, E4E1C6F01E278FCC00A62D66 /* UIImageView+Extension.podspec */, ); name = Podspec; @@ -223,12 +229,13 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + E4CA26021E27D294007D51C8 /* Screenshoots in Resources */, E443BD141E2769B9006140E8 /* LaunchScreen.storyboard in Resources */, E4E1C6F11E278FCC00A62D66 /* UIImageView+Extension.podspec in Resources */, E443BD111E2769B9006140E8 /* Assets.xcassets in Resources */, E443BD0F1E2769B9006140E8 /* Main.storyboard in Resources */, E42425711E27AFB60052A669 /* demo.jpg in Resources */, - E4E1C6F31E278FFF00A62D66 /* LICENSE.md in Resources */, + E4E1C6F31E278FFF00A62D66 /* LICENSE in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -248,6 +255,7 @@ files = ( E443BD0C1E2769B9006140E8 /* ViewController.m in Sources */, E443BD091E2769B9006140E8 /* AppDelegate.m in Sources */, + E4CA26001E27CC0A007D51C8 /* README.md in Sources */, E443BD3D1E276ABD006140E8 /* UIImageView+Extension.m in Sources */, E443BD061E2769B9006140E8 /* main.m in Sources */, ); diff --git a/UIImageView+Extension.podspec b/UIImageView+Extension.podspec index 73a756b..e6bc37c 100644 --- a/UIImageView+Extension.podspec +++ b/UIImageView+Extension.podspec @@ -1,16 +1,17 @@ Pod::Spec.new do |s| s.name = "UIImageView+Extension" s.version = "0.1.0" - s.summary = "A extension category for UIImageView." + s.summary = "A simple UIImageView category with some extension functions." s.description = <<-DESC # Features - - Add border for image view - - Add shadow for image view + - Supports Interface Builder. + - Set border radius for image view. + - Set shadow for image view. DESC s.homepage = "https://github.com/lm2343635/UIImageView-Extension" - s.license = { :type => "MIT", :file => "LICENSE.md" } + s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Meng Li" => "lm2343635@126.com" } s.social_media_url = "http://fczm.pw" diff --git a/UIImageView+Extension/UIImageView+Extension.h b/UIImageView+Extension/UIImageView+Extension.h index 9a990d5..df337e8 100644 --- a/UIImageView+Extension/UIImageView+Extension.h +++ b/UIImageView+Extension/UIImageView+Extension.h @@ -6,6 +6,24 @@ // Copyright © 2017 fczm.pw. All rights reserved. // +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + #import @interface UIImageView (Extension) diff --git a/UIImageView+Extension/UIImageView+Extension.m b/UIImageView+Extension/UIImageView+Extension.m index 1b76d20..b9ad750 100644 --- a/UIImageView+Extension/UIImageView+Extension.m +++ b/UIImageView+Extension/UIImageView+Extension.m @@ -6,6 +6,24 @@ // Copyright © 2017 fczm.pw. All rights reserved. // +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + #import "UIImageView+Extension.h" #import @@ -37,6 +55,8 @@ - (void)setImageCornerRadius:(CGFloat)radius { } #pragma mark - Shadow +// This method should be invoked before you invoke methods including changeShadowColor:color, +// changeShadowXOffset:xOffset, changeShadowYOffset:yOffset and changeShadowRadius:(CGFloat)radius. - (void)setShadowWithColor:(UIColor *)color shadowXOffset:(CGFloat)xOffset shadowYOffset:(CGFloat)yOffset