├── Assets ├── Step1a.png ├── Step1b.png ├── Step2a.png ├── Step2b.png ├── Step2c.png ├── Step3a.png ├── Step3b.png ├── Step3c.png ├── Step4a.png ├── Step4b.png ├── Step4c.png ├── Step5a.png ├── Step5b.png ├── Test.xcf └── GitBanner.png ├── Example ├── GradientView │ ├── Blogger_Sans.otf │ ├── GradientViewController.h │ ├── GradientViewAppDelegate.h │ ├── main.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── GradientViewAppDelegate.m │ └── GradientViewController.m └── GradientView.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── project.pbxproj ├── EZYGradientView-ObjC.podspec ├── CHANGELOG.md ├── LICENSE ├── .gitignore ├── EZYGradientView ├── EZYGradientView.h └── EZYGradientView.m └── README.md /Assets/Step1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step1a.png -------------------------------------------------------------------------------- /Assets/Step1b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step1b.png -------------------------------------------------------------------------------- /Assets/Step2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step2a.png -------------------------------------------------------------------------------- /Assets/Step2b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step2b.png -------------------------------------------------------------------------------- /Assets/Step2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step2c.png -------------------------------------------------------------------------------- /Assets/Step3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step3a.png -------------------------------------------------------------------------------- /Assets/Step3b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step3b.png -------------------------------------------------------------------------------- /Assets/Step3c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step3c.png -------------------------------------------------------------------------------- /Assets/Step4a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step4a.png -------------------------------------------------------------------------------- /Assets/Step4b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step4b.png -------------------------------------------------------------------------------- /Assets/Step4c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step4c.png -------------------------------------------------------------------------------- /Assets/Step5a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step5a.png -------------------------------------------------------------------------------- /Assets/Step5b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Step5b.png -------------------------------------------------------------------------------- /Assets/Test.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/Test.xcf -------------------------------------------------------------------------------- /Assets/GitBanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Assets/GitBanner.png -------------------------------------------------------------------------------- /Example/GradientView/Blogger_Sans.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView-ObjC/HEAD/Example/GradientView/Blogger_Sans.otf -------------------------------------------------------------------------------- /Example/GradientView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/GradientView/GradientViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // GradientView 4 | // 5 | // Created by Shashank Pali on 28/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GradientViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Example/GradientView/GradientViewAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // GradientView 4 | // 5 | // Created by Shashank Pali on 28/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GradientViewAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/GradientView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GradientView 4 | // 5 | // Created by Shashank Pali on 28/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GradientViewAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([GradientViewAppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /EZYGradientView-ObjC.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = 'EZYGradientView-ObjC' 4 | s.version = '1.3' 5 | s.platform = :ios, '8.0' 6 | s.license = { :type => 'MIT' } 7 | s.homepage = 'https://github.com/shashankpali/EZYGradientView-ObjC' 8 | s.authors = { 'Shashank Pali' => 'shank.pali@gmail.com' } 9 | s.summary = 'Create gradients and blur gradients without a single line of code' 10 | s.source = { :git => 'https://github.com/shashankpali/EZYGradientView-ObjC.git', :tag => s.version } 11 | s.source_files = 'EZYGradientView/*.{h,m}' 12 | s.requires_arc = true 13 | end -------------------------------------------------------------------------------- /Example/GradientView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [1.3](https://github.com/shashankpali/EZYGradientView-ObjC/releases/tag/1.3) 4 | Released on Friday, 19 Aug, 2016. 5 | 6 | #### Fixed 7 | *"blurLayer" property now shows color separation. 8 | 9 | ## [1.2](https://github.com/shashankpali/EZYGradientView-ObjC/releases/tag/1.2) 10 | Released on Wednesday, 3 Aug, 2016. 11 | 12 | #### Fixed 13 | * Issue #1 solved: Doesn't update on changing properties. 14 | 15 | ## [1.1.1](https://github.com/shashankpali/EZYGradientView-ObjC/releases/tag/1.1.1) 16 | Released on Thursday, 28 Jul, 2016. 17 | 18 | #### Added 19 | * clearColor to designated initializer. 20 | 21 | #### Updated 22 | * documentation. 23 | 24 | ## [1.1](https://github.com/shashankpali/EZYGradientView-ObjC/releases/tag/1.1) 25 | Released on Thursday, 28 Jul, 2016. 26 | 27 | #### Update 28 | * podspec name. 29 | 30 | 31 | ## [1.0](https://github.com/shashankpali/EZYGradientView-ObjC/releases/tag/1.0) 32 | Released on Thursday, 28 Jul, 2016. 33 | 34 | #### Added 35 | * Initial release. 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Shashank Pali 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Example/GradientView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIAppFonts 26 | 27 | Blogger_Sans-Light.otf 28 | Blogger_Sans.otf 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /Example/GradientView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/GradientView/GradientViewAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // GradientView 4 | // 5 | // Created by Shashank Pali on 28/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | #import "GradientViewAppDelegate.h" 10 | 11 | @interface GradientViewAppDelegate () 12 | 13 | @end 14 | 15 | @implementation GradientViewAppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Example/GradientView/GradientViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // GradientView 4 | // 5 | // Created by Shashank Pali on 28/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | #import "GradientViewController.h" 10 | #import "EZYGradientView.h" 11 | 12 | @interface GradientViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UITableView *table; 15 | @property (weak, nonatomic) IBOutlet EZYGradientView *navBarGradient; 16 | 17 | @end 18 | 19 | @implementation GradientViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | 25 | _table.contentInset = UIEdgeInsetsMake(44, 0, 49, 0); 26 | _table.scrollIndicatorInsets = _table.contentInset; 27 | } 28 | 29 | - (void)viewDidAppear:(BOOL)animated 30 | { 31 | [super viewDidAppear:animated]; 32 | _navBarGradient.blurLayer.cornerRadius = _navBarGradient.frame.size.width/2; 33 | _navBarGradient.blurLayer.masksToBounds = YES; 34 | } 35 | 36 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 37 | { 38 | return 10; 39 | } 40 | 41 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 42 | { 43 | return @(section).stringValue; 44 | } 45 | 46 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 47 | { 48 | return 10; 49 | } 50 | 51 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 52 | { 53 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 54 | 55 | EZYGradientView *cellView = (EZYGradientView *)[cell viewWithTag:10]; 56 | cellView.firstColor = [UIColor colorWithRed:[self colorCode] green:[self colorCode] blue:[self colorCode] alpha:1]; 57 | cellView.secondColor = [UIColor colorWithRed:[self colorCode] green:[self colorCode] blue:[self colorCode] alpha:1]; 58 | cellView.angleº = [self colorCode] * 30; 59 | cellView.colorRatio = 0.5; 60 | cellView.fadeIntensity = 1; 61 | 62 | return cell; 63 | } 64 | 65 | - (CGFloat)colorCode 66 | { 67 | CGFloat colorNumber = (arc4random()%255) / 255.0 ; 68 | return colorNumber; 69 | } 70 | 71 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 72 | { 73 | return 70; 74 | } 75 | 76 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 77 | { 78 | 79 | } 80 | 81 | - (void)didReceiveMemoryWarning { 82 | [super didReceiveMemoryWarning]; 83 | // Dispose of any resources that can be recreated. 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /EZYGradientView/EZYGradientView.h: -------------------------------------------------------------------------------- 1 | // EZYGradientView.h 2 | // 3 | // Copyright (c) 2016 Shashank Pali 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | IB_DESIGNABLE 26 | 27 | @interface EZYGradientView : UIView 28 | 29 | /** 30 | * Gradient layer provide canvas to draw gradient 31 | */ 32 | @property (strong, nonatomic) CAGradientLayer *gradientLayer; 33 | /** 34 | * Blur layer allow to customize the blur effect 35 | */ 36 | @property (strong, nonatomic) CALayer *blurLayer; 37 | /** 38 | * First color of gradient i.e. it appears on top when angleº set to 0.0. 39 | */ 40 | @property (strong, nonatomic) IBInspectable UIColor *firstColor; 41 | /** 42 | * Second color of gradient i.e. it appears in bottom when angleº set to 0.0. 43 | */ 44 | @property (strong, nonatomic) IBInspectable UIColor *secondColor; 45 | /** 46 | * Angleº will describe the tilt of gradient. 47 | */ 48 | @property (assign, nonatomic) IBInspectable CGFloat angleº; 49 | /** 50 | * Color ratio will describe the proportion of colors. Its value ranges from 0.0 to 1.0 default is 0.5. 51 | */ 52 | @property (assign, nonatomic) IBInspectable CGFloat colorRatio; 53 | /** 54 | * Fade intensity will describe the disperse of colors. Its value ranges from 0.0 to 1.0 default is 0.0. 55 | */ 56 | @property (assign, nonatomic) IBInspectable CGFloat fadeIntensity; 57 | /** 58 | * Is blur allows to add visual effect on gradient view. Can't be changed during run-time. 59 | */ 60 | @property (assign, nonatomic) IBInspectable BOOL isBlur; 61 | /** 62 | * Blur opacity will describe the transparency of blur. Its value ranges from 0.0 to 1.0 default is 0.0. It is suggested to set EZYGradientView background color as clear color for better results. 63 | */ 64 | @property (assign, nonatomic) IBInspectable CGFloat blurOpacity; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![EZYGradientView](Assets/GitBanner.png) 2 | 3 | `EZYGradientView` is a different and unique take on creating gradients and gradients with blur on the iOS platform. The default `CAGradientLayer` implementation works just fine, but is confusing and gives different results than expected. From the documentation: 4 | 5 | > The start point corresponds to the first stop of the gradient. The point is defined in the unit coordinate space and is then mapped to the layer’s bounds rectangle when drawn. 6 | 7 | It's not really clear what the mapped values for the start and end points will be. If we set the start x coordinate 0.2, it does not resolve to 0.2 of the view's width on the X-axis. 8 | 9 | This library attempts to create gradients intuitively. When you use `EZYGradientView`, you don't need to worry about Apple's default API. What you do need to concern yourself with is: 10 | 11 | * What your colors are 12 | * The angle of the gradient 13 | * The ratio in which the two colors are distributed; and finally... 14 | * The intensity with which the colors are dispersed 15 | 16 | `EZYGradientView` exposes five properties you can modify to customize your gradient. The view itself is `IBDesignable` and its properties `IBInspectable` which means you can customize your gradient in real time on an xib or storyboard. 17 | 18 | # Pod Installation 19 | 20 | CocoaPods is the preferred way to install this library. Add both the command to your `Podfile`: 21 | 22 | ``` 23 | use_frameworks! 24 | pod 'EZYGradientView-ObjC' 25 | ``` 26 | 27 | 28 | 29 | 30 | ###For [Swift](https://github.com/shashankpali/EZYGradientView) 31 | 32 | 33 | # Direct Installation 34 | 35 | Download .zip file and extract it. There you will find the `EZYGradientView` folder, copy all the files to your respective project. 36 | 37 | # Integration Methods 38 | 39 | ## Storyboard/Xib 40 | 41 | Just follow these simple steps and create a gradient inside your xib or storyboard! 42 | 43 | ### Step 1 - Select colors 44 | 45 | | Step | Description | 46 | |-------------------------------|---------------| 47 | | ![Step 1a](Assets/Step1a.png) | | 48 | | ![Step 1b](Assets/Step1b.png) | | 49 | 50 | ### Step 2 - Set gradient angle 51 | 52 | | Step | Description | 53 | |-------------------------------|----------------| 54 | | ![Step 2a](Assets/Step2a.png) | Default is 0º. | 55 | | ![Step 2b](Assets/Step2b.png) | At 45º. | 56 | | ![Step 2c](Assets/Step2c.png) | At 135º. | 57 | 58 | ### Step 3 - Set color ratio 59 | 60 | | Step | Description | 61 | |-------------------------------|-----------------------------------------------------------------------------------------------| 62 | | ![Step 3a](Assets/Step3a.png) | Default is 0.5, that's why colors are equally divided. Valid range 0 to 1. | 63 | | ![Step 3b](Assets/Step3b.png) | At 0.1, the first color takes one-tenth of the view area. The rest is filled by the second. | 64 | | ![Step 3c](Assets/Step3c.png) | At 0.9, the first color takes nine-tenths of the view area. The rest is filled by the second. | 65 | 66 | ### Step 4 - Set fade intensity 67 | 68 | | Step | Description | 69 | |-------------------------------|---------------------------------------------------------------------------------------------------| 70 | | ![Step 4a](Assets/Step4a.png) | Default is 0, that's why there is a sharp boundary where the two colors meet. Valid range 0 to 1. | 71 | | ![Step 4b](Assets/Step4b.png) | At 0.5, there is a much smoother transition between the two colors. | 72 | | ![Step 4c](Assets/Step4c.png) | At 1, the maximum transition smoothness is achieved. | 73 | 74 | ### Step 5 - Set isBlur and blur opacity 75 | ######(This feature is available for ios 8 and above) 76 | 77 | 78 | | Step | Description | 79 | |-------------------------------|---------------------------------------------------------------------------------------------------| 80 | | ![Step 5a](Assets/Step5a.png) | Default is 0, where the blur transparency is minimmum. Valid range 0 to 1. | 81 | | ![Step 5b](Assets/Step5b.png) | At 1.0, where the blur transparency is maximum.(The black spot is a label behind gradient view) | 82 | | Suggestion | Use this properties to design `navigationBar`, `tabBar`, `tableHeaderView` etc. | 83 | 84 | ## Programmatic way 85 | 86 | ```objc 87 | EZYGradientView *gradientView = [[EZYGradientView alloc] init]; 88 | gradientView.frame = self.view.frame; 89 | gradientView.firstColor = [UIColor orangeColor]; 90 | gradientView.secondColor = [UIColor greenColor]; 91 | gradientView.angleº = 45; 92 | gradientView.colorRatio = 0.5; 93 | gradientView.fadeIntensity = 1; 94 | gradientView.isBlur = YES; 95 | gradientView.blurOpacity = 0.5; 96 | [self.view addSubView:gradientView]; 97 | ``` 98 | 99 | # To-do 100 | 101 | * Allow more than two colors to create gradients. 102 | * It may crash if blur properties used in lower version than ios 8. 103 | * Use CoreGraphics blur to replace `UIVisualEffectView`. 104 | 105 | # Thanks 106 | 107 | * To [Sudeep Jaiswal](https://github.com/sudeepjaiswal) for motivating and special thanks for the documentation and ideas. 108 | 109 | # License 110 | 111 | `EZYGradientView` is available under the MIT license. See the LICENSE file for more info. 112 | -------------------------------------------------------------------------------- /EZYGradientView/EZYGradientView.m: -------------------------------------------------------------------------------- 1 | // EZYGradientView.m 2 | // 3 | // Copyright (c) 2016 Shashank Pali 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "EZYGradientView.h" 24 | 25 | struct EZYPoints 26 | { 27 | CGPoint start; 28 | CGPoint end; 29 | }; 30 | 31 | struct EZYPoints EZYPointsMake(CGPoint start, CGPoint end) 32 | { 33 | struct EZYPoints e; 34 | e.start = start; 35 | e.end = end; 36 | return e; 37 | } 38 | 39 | struct EZYLocations 40 | { 41 | CGFloat firstColor; 42 | CGFloat secondColor; 43 | }; 44 | 45 | struct EZYLocations EZYLocationsMake(CGFloat firstColor, CGFloat secondColor) 46 | { 47 | struct EZYLocations l; 48 | l.firstColor = firstColor; 49 | l.secondColor = secondColor; 50 | return l; 51 | } 52 | 53 | @interface EZYGradientView () 54 | 55 | @property (strong, nonatomic) UIVisualEffectView *blurView; 56 | 57 | @end 58 | 59 | @implementation EZYGradientView 60 | 61 | #pragma mark - Designated Initializer 62 | 63 | - (instancetype)initWithFrame:(CGRect)frame 64 | { 65 | self = [super initWithFrame:frame]; 66 | if (self) 67 | { 68 | [self defaultValueToProperties]; 69 | self.backgroundColor = [UIColor clearColor]; 70 | } 71 | return self; 72 | } 73 | 74 | - (instancetype)initWithCoder:(NSCoder *)coder 75 | { 76 | self = [super initWithCoder:coder]; 77 | if (self) 78 | { 79 | [self defaultValueToProperties]; 80 | self.backgroundColor = [UIColor clearColor]; 81 | } 82 | return self; 83 | } 84 | 85 | #pragma mark - Draw Rect with steps 86 | 87 | - (void)drawRect:(CGRect)rect 88 | { 89 | if (_gradientLayer == nil) 90 | { 91 | _gradientLayer = [CAGradientLayer layer]; 92 | _gradientLayer.frame = self.bounds; 93 | [self.layer insertSublayer:_gradientLayer atIndex:0]; 94 | } 95 | [self updateColors]; 96 | [self updatePoints]; 97 | [self updateLocations]; 98 | [self checkBlurStatusAndUpdateOpacity]; 99 | } 100 | /** 101 | * Step 1 102 | */ 103 | - (void)updateColors 104 | { 105 | _gradientLayer.colors = @[(id)_firstColor.CGColor, (id)_secondColor.CGColor]; 106 | } 107 | /** 108 | * Step 2 109 | */ 110 | - (void)updatePoints 111 | { 112 | struct EZYPoints points = [self startEndPoints]; 113 | _gradientLayer.startPoint = points.start; 114 | _gradientLayer.endPoint = points.end; 115 | } 116 | /** 117 | * Step 3 118 | */ 119 | - (void)updateLocations 120 | { 121 | struct EZYLocations locations = [self locations]; 122 | _gradientLayer.locations = @[@(locations.firstColor), @(locations.secondColor)]; 123 | } 124 | /** 125 | * Step 4 126 | */ 127 | - (void)checkBlurStatusAndUpdateOpacity 128 | { 129 | if (_isBlur) 130 | { 131 | _gradientLayer.colors = @[(id)[self blurColor:_firstColor], (id)[self blurColor:_secondColor]]; 132 | [self.layer insertSublayer:self.blurLayer below:_gradientLayer]; 133 | } 134 | else 135 | { 136 | [_blurLayer removeFromSuperlayer]; 137 | _blurLayer = nil; 138 | _blurView = nil; 139 | } 140 | } 141 | 142 | #pragma mark - Default Value 143 | 144 | - (void)defaultValueToProperties 145 | { 146 | _firstColor = [UIColor whiteColor]; 147 | _secondColor = [UIColor whiteColor]; 148 | self.angleº = 0; 149 | _colorRatio = 0.5; 150 | _fadeIntensity = 0; 151 | _isBlur = NO; 152 | _blurOpacity = 0; 153 | } 154 | 155 | #pragma mark - Helpers 156 | 157 | - (CGColorRef)blurColor:(UIColor *)color 158 | { 159 | return [color colorWithAlphaComponent:0.9 - (_blurOpacity / 2)].CGColor; 160 | } 161 | 162 | - (struct EZYPoints)startEndPoints 163 | { 164 | CGFloat rotCalX = 0.0, rotCalY = 0.0; 165 | CGFloat rotate = _angleº / 90; 166 | 167 | if (rotate <= 1) 168 | { 169 | rotCalY = rotate; 170 | } 171 | else if (rotate <= 2) 172 | { 173 | rotCalY = 1; 174 | rotCalX = rotate - 1; 175 | } 176 | else if (rotate <= 3) 177 | { 178 | rotCalX = 1; 179 | rotCalY = 1 - (rotate - 2); 180 | } 181 | else if (rotate <= 4) 182 | { 183 | rotCalX = 1 - (rotate - 3); 184 | } 185 | 186 | CGPoint start = CGPointMake(1 - rotCalY, 0 + rotCalX); 187 | CGPoint end = CGPointMake(0 + rotCalY, 1 - rotCalX); 188 | 189 | return EZYPointsMake(start, end); 190 | } 191 | 192 | - (struct EZYLocations)locations 193 | { 194 | CGFloat divider = _fadeIntensity / [self divider]; 195 | return EZYLocationsMake(_colorRatio - divider, _colorRatio + divider); 196 | } 197 | 198 | - (CGFloat)divider 199 | { 200 | if (_colorRatio == 0.1) 201 | { 202 | return 10; 203 | } 204 | if (_colorRatio < 0.5) 205 | { 206 | CGFloat value = 0.5 - _colorRatio + 0.5; 207 | return 1 / (1 - value); 208 | } 209 | return 1 / (1 - _colorRatio); 210 | } 211 | 212 | #pragma mark - Properties 213 | 214 | - (void)setFirstColor:(UIColor *)firstColor 215 | { 216 | _firstColor = firstColor; 217 | if (_gradientLayer != nil) 218 | { 219 | [self updateColors]; 220 | } 221 | } 222 | 223 | - (void)setSecondColor:(UIColor *)secondColor 224 | { 225 | _secondColor = secondColor; 226 | if (_gradientLayer != nil) 227 | { 228 | [self updateColors]; 229 | } 230 | } 231 | 232 | - (void)setAngleº:(CGFloat)angleº 233 | { 234 | _angleº = angleº; 235 | 236 | // handle negative angleºs 237 | if (_angleº < 0.0) 238 | { 239 | _angleº = 360.0 + _angleº; 240 | } 241 | 242 | // offset of 45 is needed to make logic work 243 | _angleº = _angleº + 45; 244 | 245 | NSInteger multiplier = _angleº / 360; 246 | if (multiplier > 0) 247 | { 248 | _angleº = _angleº - 360 * multiplier; 249 | } 250 | 251 | if (_gradientLayer != nil) 252 | { 253 | [self updatePoints]; 254 | } 255 | } 256 | 257 | - (void)setColorRatio:(CGFloat)colorRatio 258 | { 259 | if (colorRatio <= 1 && colorRatio >= 0) 260 | { 261 | _colorRatio = colorRatio; 262 | } 263 | else 264 | { 265 | _colorRatio = 0.5; 266 | } 267 | 268 | if (_gradientLayer != nil) 269 | { 270 | [self updateLocations]; 271 | } 272 | } 273 | 274 | - (void)setFadeIntensity:(CGFloat)fadeIntensity 275 | { 276 | if (fadeIntensity <= 1 && fadeIntensity >= 0) 277 | { 278 | _fadeIntensity = fadeIntensity; 279 | } 280 | else 281 | { 282 | _fadeIntensity = 0.5; 283 | } 284 | 285 | if (_gradientLayer != nil) 286 | { 287 | [self updateLocations]; 288 | } 289 | } 290 | 291 | - (void)setBlurOpacity:(CGFloat)blurOpacity 292 | { 293 | if (blurOpacity <= 1 && blurOpacity >= 0) 294 | { 295 | _blurOpacity = blurOpacity; 296 | } 297 | else 298 | { 299 | _blurOpacity = 0.5; 300 | } 301 | 302 | if (_gradientLayer != nil) 303 | { 304 | [self checkBlurStatusAndUpdateOpacity]; 305 | } 306 | } 307 | 308 | - (CALayer *)blurLayer 309 | { 310 | if (_blurView == nil) 311 | { 312 | UIVisualEffect *blurEffect; 313 | blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; 314 | _blurView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; 315 | _blurView.frame = self.bounds; 316 | _blurLayer = [CALayer layer]; 317 | _blurLayer = _blurView.layer; 318 | 319 | return _blurLayer; 320 | } 321 | return _blurLayer; 322 | } 323 | 324 | @end 325 | -------------------------------------------------------------------------------- /Example/GradientView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6BCD343A1D51BF3C00700EC5 /* Blogger_Sans.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6BCD34391D51BF3C00700EC5 /* Blogger_Sans.otf */; }; 11 | 6BD0D78E1D51B38D00C2BFF8 /* EZYGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BD0D78D1D51B38D00C2BFF8 /* EZYGradientView.m */; }; 12 | 6CBDCA6F1D489114004135D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6CBDCA611D489114004135D0 /* Assets.xcassets */; }; 13 | 6CBDCA701D489114004135D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CBDCA621D489114004135D0 /* LaunchScreen.storyboard */; }; 14 | 6CBDCA711D489114004135D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CBDCA641D489114004135D0 /* Main.storyboard */; }; 15 | 6CBDCA731D489114004135D0 /* GradientViewAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CBDCA6A1D489114004135D0 /* GradientViewAppDelegate.m */; }; 16 | 6CBDCA741D489114004135D0 /* GradientViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CBDCA6C1D489114004135D0 /* GradientViewController.m */; }; 17 | 6CBDCA761D489114004135D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CBDCA6E1D489114004135D0 /* main.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 6BCD34391D51BF3C00700EC5 /* Blogger_Sans.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Blogger_Sans.otf; sourceTree = ""; }; 22 | 6BD0D78C1D51B38D00C2BFF8 /* EZYGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZYGradientView.h; sourceTree = ""; }; 23 | 6BD0D78D1D51B38D00C2BFF8 /* EZYGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZYGradientView.m; sourceTree = ""; }; 24 | 6CBDCA611D489114004135D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 6CBDCA631D489114004135D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 6CBDCA651D489114004135D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 6CBDCA691D489114004135D0 /* GradientViewAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GradientViewAppDelegate.h; sourceTree = ""; }; 28 | 6CBDCA6A1D489114004135D0 /* GradientViewAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GradientViewAppDelegate.m; sourceTree = ""; }; 29 | 6CBDCA6B1D489114004135D0 /* GradientViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GradientViewController.h; sourceTree = ""; }; 30 | 6CBDCA6C1D489114004135D0 /* GradientViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GradientViewController.m; sourceTree = ""; }; 31 | 6CBDCA6D1D489114004135D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 6CBDCA6E1D489114004135D0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 6CE67E1D1D45D7EE008700C4 /* GradientView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GradientView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 6CE67E1A1D45D7EE008700C4 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 6BD0D78B1D51B38D00C2BFF8 /* EZYGradientView */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 6BD0D78C1D51B38D00C2BFF8 /* EZYGradientView.h */, 51 | 6BD0D78D1D51B38D00C2BFF8 /* EZYGradientView.m */, 52 | ); 53 | name = EZYGradientView; 54 | path = ../../EZYGradientView; 55 | sourceTree = ""; 56 | }; 57 | 6CBDCA601D489114004135D0 /* GradientView */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 6BD0D78B1D51B38D00C2BFF8 /* EZYGradientView */, 61 | 6CBDCA691D489114004135D0 /* GradientViewAppDelegate.h */, 62 | 6CBDCA6A1D489114004135D0 /* GradientViewAppDelegate.m */, 63 | 6CBDCA6B1D489114004135D0 /* GradientViewController.h */, 64 | 6CBDCA6C1D489114004135D0 /* GradientViewController.m */, 65 | 6CBDCA641D489114004135D0 /* Main.storyboard */, 66 | 6CBDCA611D489114004135D0 /* Assets.xcassets */, 67 | 6CBDCA621D489114004135D0 /* LaunchScreen.storyboard */, 68 | 6CBDCA6D1D489114004135D0 /* Info.plist */, 69 | 6BCD34391D51BF3C00700EC5 /* Blogger_Sans.otf */, 70 | 6CBDCA6E1D489114004135D0 /* main.m */, 71 | ); 72 | path = GradientView; 73 | sourceTree = ""; 74 | }; 75 | 6CE67E141D45D7EE008700C4 = { 76 | isa = PBXGroup; 77 | children = ( 78 | 6CBDCA601D489114004135D0 /* GradientView */, 79 | 6CE67E1E1D45D7EE008700C4 /* Products */, 80 | ); 81 | sourceTree = ""; 82 | }; 83 | 6CE67E1E1D45D7EE008700C4 /* Products */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 6CE67E1D1D45D7EE008700C4 /* GradientView.app */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | /* End PBXGroup section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | 6CE67E1C1D45D7EE008700C4 /* GradientView */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = 6CE67E341D45D7EE008700C4 /* Build configuration list for PBXNativeTarget "GradientView" */; 97 | buildPhases = ( 98 | 6CE67E191D45D7EE008700C4 /* Sources */, 99 | 6CE67E1A1D45D7EE008700C4 /* Frameworks */, 100 | 6CE67E1B1D45D7EE008700C4 /* Resources */, 101 | ); 102 | buildRules = ( 103 | ); 104 | dependencies = ( 105 | ); 106 | name = GradientView; 107 | productName = testing; 108 | productReference = 6CE67E1D1D45D7EE008700C4 /* GradientView.app */; 109 | productType = "com.apple.product-type.application"; 110 | }; 111 | /* End PBXNativeTarget section */ 112 | 113 | /* Begin PBXProject section */ 114 | 6CE67E151D45D7EE008700C4 /* Project object */ = { 115 | isa = PBXProject; 116 | attributes = { 117 | LastUpgradeCheck = 0730; 118 | ORGANIZATIONNAME = Shashank; 119 | TargetAttributes = { 120 | 6CE67E1C1D45D7EE008700C4 = { 121 | CreatedOnToolsVersion = 7.3.1; 122 | }; 123 | }; 124 | }; 125 | buildConfigurationList = 6CE67E181D45D7EE008700C4 /* Build configuration list for PBXProject "GradientView" */; 126 | compatibilityVersion = "Xcode 3.2"; 127 | developmentRegion = English; 128 | hasScannedForEncodings = 0; 129 | knownRegions = ( 130 | en, 131 | Base, 132 | ); 133 | mainGroup = 6CE67E141D45D7EE008700C4; 134 | productRefGroup = 6CE67E1E1D45D7EE008700C4 /* Products */; 135 | projectDirPath = ""; 136 | projectRoot = ""; 137 | targets = ( 138 | 6CE67E1C1D45D7EE008700C4 /* GradientView */, 139 | ); 140 | }; 141 | /* End PBXProject section */ 142 | 143 | /* Begin PBXResourcesBuildPhase section */ 144 | 6CE67E1B1D45D7EE008700C4 /* Resources */ = { 145 | isa = PBXResourcesBuildPhase; 146 | buildActionMask = 2147483647; 147 | files = ( 148 | 6CBDCA711D489114004135D0 /* Main.storyboard in Resources */, 149 | 6BCD343A1D51BF3C00700EC5 /* Blogger_Sans.otf in Resources */, 150 | 6CBDCA6F1D489114004135D0 /* Assets.xcassets in Resources */, 151 | 6CBDCA701D489114004135D0 /* LaunchScreen.storyboard in Resources */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXResourcesBuildPhase section */ 156 | 157 | /* Begin PBXSourcesBuildPhase section */ 158 | 6CE67E191D45D7EE008700C4 /* Sources */ = { 159 | isa = PBXSourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 6CBDCA741D489114004135D0 /* GradientViewController.m in Sources */, 163 | 6BD0D78E1D51B38D00C2BFF8 /* EZYGradientView.m in Sources */, 164 | 6CBDCA761D489114004135D0 /* main.m in Sources */, 165 | 6CBDCA731D489114004135D0 /* GradientViewAppDelegate.m in Sources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXSourcesBuildPhase section */ 170 | 171 | /* Begin PBXVariantGroup section */ 172 | 6CBDCA621D489114004135D0 /* LaunchScreen.storyboard */ = { 173 | isa = PBXVariantGroup; 174 | children = ( 175 | 6CBDCA631D489114004135D0 /* Base */, 176 | ); 177 | name = LaunchScreen.storyboard; 178 | sourceTree = ""; 179 | }; 180 | 6CBDCA641D489114004135D0 /* Main.storyboard */ = { 181 | isa = PBXVariantGroup; 182 | children = ( 183 | 6CBDCA651D489114004135D0 /* Base */, 184 | ); 185 | name = Main.storyboard; 186 | sourceTree = ""; 187 | }; 188 | /* End PBXVariantGroup section */ 189 | 190 | /* Begin XCBuildConfiguration section */ 191 | 6CE67E321D45D7EE008700C4 /* Debug */ = { 192 | isa = XCBuildConfiguration; 193 | buildSettings = { 194 | ALWAYS_SEARCH_USER_PATHS = NO; 195 | CLANG_ANALYZER_NONNULL = YES; 196 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 197 | CLANG_CXX_LIBRARY = "libc++"; 198 | CLANG_ENABLE_MODULES = YES; 199 | CLANG_ENABLE_OBJC_ARC = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_CONSTANT_CONVERSION = YES; 202 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 203 | CLANG_WARN_EMPTY_BODY = YES; 204 | CLANG_WARN_ENUM_CONVERSION = YES; 205 | CLANG_WARN_INT_CONVERSION = YES; 206 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 210 | COPY_PHASE_STRIP = NO; 211 | DEBUG_INFORMATION_FORMAT = dwarf; 212 | ENABLE_STRICT_OBJC_MSGSEND = YES; 213 | ENABLE_TESTABILITY = YES; 214 | GCC_C_LANGUAGE_STANDARD = gnu99; 215 | GCC_DYNAMIC_NO_PIC = NO; 216 | GCC_NO_COMMON_BLOCKS = YES; 217 | GCC_OPTIMIZATION_LEVEL = 0; 218 | GCC_PREPROCESSOR_DEFINITIONS = ( 219 | "DEBUG=1", 220 | "$(inherited)", 221 | ); 222 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 223 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 224 | GCC_WARN_UNDECLARED_SELECTOR = YES; 225 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 226 | GCC_WARN_UNUSED_FUNCTION = YES; 227 | GCC_WARN_UNUSED_VARIABLE = YES; 228 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 229 | MTL_ENABLE_DEBUG_INFO = YES; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = iphoneos; 232 | }; 233 | name = Debug; 234 | }; 235 | 6CE67E331D45D7EE008700C4 /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ALWAYS_SEARCH_USER_PATHS = NO; 239 | CLANG_ANALYZER_NONNULL = YES; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_CONSTANT_CONVERSION = YES; 246 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 247 | CLANG_WARN_EMPTY_BODY = YES; 248 | CLANG_WARN_ENUM_CONVERSION = YES; 249 | CLANG_WARN_INT_CONVERSION = YES; 250 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 251 | CLANG_WARN_UNREACHABLE_CODE = YES; 252 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 253 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 254 | COPY_PHASE_STRIP = NO; 255 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 256 | ENABLE_NS_ASSERTIONS = NO; 257 | ENABLE_STRICT_OBJC_MSGSEND = YES; 258 | GCC_C_LANGUAGE_STANDARD = gnu99; 259 | GCC_NO_COMMON_BLOCKS = YES; 260 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 261 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 262 | GCC_WARN_UNDECLARED_SELECTOR = YES; 263 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 264 | GCC_WARN_UNUSED_FUNCTION = YES; 265 | GCC_WARN_UNUSED_VARIABLE = YES; 266 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 267 | MTL_ENABLE_DEBUG_INFO = NO; 268 | SDKROOT = iphoneos; 269 | VALIDATE_PRODUCT = YES; 270 | }; 271 | name = Release; 272 | }; 273 | 6CE67E351D45D7EE008700C4 /* Debug */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 277 | INFOPLIST_FILE = "$(SRCROOT)/GradientView/Info.plist"; 278 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 279 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 280 | PRODUCT_BUNDLE_IDENTIFIER = com.shashank.GradientView; 281 | PRODUCT_NAME = GradientView; 282 | }; 283 | name = Debug; 284 | }; 285 | 6CE67E361D45D7EE008700C4 /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | INFOPLIST_FILE = "$(SRCROOT)/GradientView/Info.plist"; 290 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 291 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 292 | PRODUCT_BUNDLE_IDENTIFIER = com.shashank.GradientView; 293 | PRODUCT_NAME = GradientView; 294 | }; 295 | name = Release; 296 | }; 297 | /* End XCBuildConfiguration section */ 298 | 299 | /* Begin XCConfigurationList section */ 300 | 6CE67E181D45D7EE008700C4 /* Build configuration list for PBXProject "GradientView" */ = { 301 | isa = XCConfigurationList; 302 | buildConfigurations = ( 303 | 6CE67E321D45D7EE008700C4 /* Debug */, 304 | 6CE67E331D45D7EE008700C4 /* Release */, 305 | ); 306 | defaultConfigurationIsVisible = 0; 307 | defaultConfigurationName = Release; 308 | }; 309 | 6CE67E341D45D7EE008700C4 /* Build configuration list for PBXNativeTarget "GradientView" */ = { 310 | isa = XCConfigurationList; 311 | buildConfigurations = ( 312 | 6CE67E351D45D7EE008700C4 /* Debug */, 313 | 6CE67E361D45D7EE008700C4 /* Release */, 314 | ); 315 | defaultConfigurationIsVisible = 0; 316 | defaultConfigurationName = Release; 317 | }; 318 | /* End XCConfigurationList section */ 319 | }; 320 | rootObject = 6CE67E151D45D7EE008700C4 /* Project object */; 321 | } 322 | -------------------------------------------------------------------------------- /Example/GradientView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | BloggerSans 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | --------------------------------------------------------------------------------