├── .gitignore ├── LICENSE.txt ├── OBGradientView ├── OBGradientView.h └── OBGradientView.m ├── OBGradientViewDemo-screenshot.png ├── OBGradientViewDemo ├── Classes │ ├── OBGradientViewDemoAppDelegate.h │ ├── OBGradientViewDemoAppDelegate.m │ ├── OBGradientViewDemoViewController.h │ └── OBGradientViewDemoViewController.m ├── MainWindow.xib ├── OBGradientViewDemo-Info.plist ├── OBGradientViewDemo.xcodeproj │ └── project.pbxproj ├── OBGradientViewDemoViewController.xib ├── OBGradientViewDemo_Prefix.pch └── main.m └── README.mdown /.gitignore: -------------------------------------------------------------------------------- 1 | ._DS_Store 2 | build/ 3 | *.pbxuser 4 | *.mode1v3 5 | 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Ole Begemann 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /OBGradientView/OBGradientView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Ole Begemann 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | /* 24 | OBGradientView.h 25 | 26 | Created by Ole Begemann 27 | April, 2010 28 | */ 29 | 30 | 31 | #import 32 | #import 33 | 34 | 35 | /* 36 | OBGradientView is a simple UIView wrapper for CAGradientLayer. It is a plain UIView whose layer 37 | is a CAGradientLayer. It is useful if using a view is more convenient than using a layer, e.g. 38 | because you want to use autoresizing masks. 39 | 40 | OBGradientView exposes all of the layer's gradient-related properties. 41 | The getters and setters just forward the calls to the layer so the syntax is just the same as 42 | for CAGradientLayer's properties itself. See the documentation for CAGradientLayer for details: 43 | http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CAGradientLayer_class/Reference/Reference.html 44 | 45 | The one exception to this is the colors property: in addition to an array of CGColorRefs, 46 | it also accepts an array of UIColor objects. Likewise, the getter returns an array of UIColors. 47 | If you need CGColorRefs, access gradientLayer.colors instead. 48 | */ 49 | 50 | 51 | @interface OBGradientView : UIView { 52 | } 53 | 54 | // Returns the view's layer. Useful if you want to access CAGradientLayer-specific properties 55 | // because you can omit the typecast. 56 | @property (nonatomic, readonly) CAGradientLayer *gradientLayer; 57 | 58 | // Gradient-related properties are forwarded to layer. 59 | // colors also accepts array of UIColor objects (in addition to array of CGColorRefs). 60 | @property (nonatomic, retain) NSArray *colors; 61 | @property (nonatomic, retain) NSArray *locations; 62 | @property (nonatomic) CGPoint startPoint; 63 | @property (nonatomic) CGPoint endPoint; 64 | @property (nonatomic, copy) NSString *type; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /OBGradientView/OBGradientView.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Ole Begemann 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | /* 24 | OBGradientView.m 25 | 26 | Created by Ole Begemann 27 | April, 2010 28 | */ 29 | 30 | #import "OBGradientView.h" 31 | 32 | 33 | 34 | #pragma mark - 35 | #pragma mark Implementation 36 | 37 | @implementation OBGradientView 38 | 39 | @dynamic gradientLayer; 40 | @dynamic colors, locations, startPoint, endPoint, type; 41 | 42 | 43 | // Make the view's layer a CAGradientLayer instance 44 | + (Class)layerClass 45 | { 46 | return [CAGradientLayer class]; 47 | } 48 | 49 | 50 | 51 | // Convenience property access to the layer help omit typecasts 52 | - (CAGradientLayer *)gradientLayer 53 | { 54 | return (CAGradientLayer *)self.layer; 55 | } 56 | 57 | 58 | 59 | #pragma mark - 60 | #pragma mark Gradient-related properties 61 | 62 | - (NSArray *)colors 63 | { 64 | NSArray *cgColors = self.gradientLayer.colors; 65 | if (cgColors == nil) { 66 | return nil; 67 | } 68 | 69 | // Convert CGColorRefs to UIColor objects 70 | NSMutableArray *uiColors = [NSMutableArray arrayWithCapacity:[cgColors count]]; 71 | for (id cgColor in cgColors) { 72 | [uiColors addObject:[UIColor colorWithCGColor:(CGColorRef)cgColor]]; 73 | } 74 | return [NSArray arrayWithArray:uiColors]; 75 | } 76 | 77 | 78 | // The colors property accepts an array of CGColorRefs or UIColor objects (or mixes between the two). 79 | // UIColors are converted to CGColor before forwarding the values to the layer. 80 | - (void)setColors:(NSArray *)newColors 81 | { 82 | NSMutableArray *newCGColors = nil; 83 | 84 | if (newColors != nil) { 85 | newCGColors = [NSMutableArray arrayWithCapacity:[newColors count]]; 86 | for (id color in newColors) { 87 | // If the array contains a UIColor, convert it to CGColor. 88 | // Leave all other types untouched. 89 | if ([color isKindOfClass:[UIColor class]]) { 90 | [newCGColors addObject:(id)[color CGColor]]; 91 | } else { 92 | [newCGColors addObject:color]; 93 | } 94 | } 95 | } 96 | 97 | self.gradientLayer.colors = newCGColors; 98 | } 99 | 100 | 101 | - (NSArray *)locations 102 | { 103 | return self.gradientLayer.locations; 104 | } 105 | 106 | - (void)setLocations:(NSArray *)newLocations 107 | { 108 | self.gradientLayer.locations = newLocations; 109 | } 110 | 111 | - (CGPoint)startPoint 112 | { 113 | return self.gradientLayer.startPoint; 114 | } 115 | 116 | - (void)setStartPoint:(CGPoint)newStartPoint 117 | { 118 | self.gradientLayer.startPoint = newStartPoint; 119 | } 120 | 121 | - (CGPoint)endPoint 122 | { 123 | return self.gradientLayer.endPoint; 124 | } 125 | 126 | - (void)setEndPoint:(CGPoint)newEndPoint 127 | { 128 | self.gradientLayer.endPoint = newEndPoint; 129 | } 130 | 131 | - (NSString *)type 132 | { 133 | return self.gradientLayer.type; 134 | } 135 | 136 | - (void) setType:(NSString *)newType 137 | { 138 | self.gradientLayer.type = newType; 139 | } 140 | 141 | @end -------------------------------------------------------------------------------- /OBGradientViewDemo-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ole/OBGradientView/080d3f87d4f39f85dd3a62d536d80c9b39fd9c66/OBGradientViewDemo-screenshot.png -------------------------------------------------------------------------------- /OBGradientViewDemo/Classes/OBGradientViewDemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // OBGradientViewDemoAppDelegate.h 3 | // OBGradientViewDemo 4 | // 5 | // Created by Ole Begemann, April 2010 6 | // 7 | 8 | #import 9 | 10 | @class OBGradientViewDemoViewController; 11 | 12 | @interface OBGradientViewDemoAppDelegate : NSObject { 13 | UIWindow *window; 14 | OBGradientViewDemoViewController *viewController; 15 | } 16 | 17 | @property (nonatomic, retain) IBOutlet UIWindow *window; 18 | @property (nonatomic, retain) IBOutlet OBGradientViewDemoViewController *viewController; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /OBGradientViewDemo/Classes/OBGradientViewDemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // OBGradientViewDemoAppDelegate.m 3 | // OBGradientViewDemo 4 | // 5 | // Created by Ole Begemann, April 2010 6 | // 7 | 8 | #import "OBGradientViewDemoAppDelegate.h" 9 | #import "OBGradientViewDemoViewController.h" 10 | 11 | @implementation OBGradientViewDemoAppDelegate 12 | 13 | @synthesize window; 14 | @synthesize viewController; 15 | 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | 19 | // Override point for customization after app launch 20 | [window addSubview:viewController.view]; 21 | [window makeKeyAndVisible]; 22 | 23 | return YES; 24 | } 25 | 26 | 27 | - (void)dealloc { 28 | [viewController release]; 29 | [window release]; 30 | [super dealloc]; 31 | } 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /OBGradientViewDemo/Classes/OBGradientViewDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // OBGradientViewDemoViewController.h 3 | // OBGradientViewDemo 4 | // 5 | // Created by Ole Begemann, April 2010 6 | // 7 | 8 | #import 9 | #import "OBGradientView.h" 10 | 11 | 12 | @interface OBGradientViewDemoViewController : UIViewController { 13 | OBGradientView *gradientView; 14 | } 15 | 16 | @property (nonatomic, retain) IBOutlet OBGradientView *gradientView; 17 | 18 | - (IBAction)gradientControlDidChange:(id)sender; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /OBGradientViewDemo/Classes/OBGradientViewDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // OBGradientViewDemoViewController.m 3 | // OBGradientViewDemo 4 | // 5 | // Created by Ole Begemann, April 2010 6 | // 7 | 8 | #import "OBGradientViewDemoViewController.h" 9 | 10 | 11 | @interface OBGradientViewDemoViewController () 12 | 13 | - (void)setRedGradient; 14 | - (void)setBlueGradient; 15 | 16 | @end 17 | 18 | 19 | 20 | @implementation OBGradientViewDemoViewController 21 | 22 | @synthesize gradientView; 23 | 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | [self setRedGradient]; 28 | } 29 | 30 | - (void)viewDidUnload { 31 | self.gradientView = nil; 32 | } 33 | 34 | - (void)dealloc { 35 | self.gradientView = nil; 36 | [super dealloc]; 37 | } 38 | 39 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 40 | return YES; 41 | } 42 | 43 | - (IBAction)gradientControlDidChange:(id)sender { 44 | UISegmentedControl *gradientControl = (UISegmentedControl *)sender; 45 | switch (gradientControl.selectedSegmentIndex) { 46 | case 0: 47 | [self setRedGradient]; 48 | break; 49 | case 1: 50 | [self setBlueGradient]; 51 | break; 52 | } 53 | } 54 | 55 | - (void)setRedGradient { 56 | NSArray *colors = [NSArray arrayWithObjects:[UIColor redColor], [UIColor yellowColor], nil]; 57 | self.gradientView.colors = colors; 58 | } 59 | 60 | - (void)setBlueGradient { 61 | NSArray *colors = [NSArray arrayWithObjects:[UIColor blueColor], [UIColor greenColor], nil]; 62 | self.gradientView.colors = colors; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /OBGradientViewDemo/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10D540 6 | 760 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 81 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | OBGradientViewDemoViewController 45 | 46 | IBCocoaTouchFramework 47 | 48 | 49 | 50 | 292 51 | {320, 480} 52 | 53 | 1 54 | MSAxIDEAA 55 | 56 | NO 57 | NO 58 | 59 | IBCocoaTouchFramework 60 | YES 61 | 62 | 63 | 64 | 65 | YES 66 | 67 | 68 | delegate 69 | 70 | 71 | 72 | 4 73 | 74 | 75 | 76 | viewController 77 | 78 | 79 | 80 | 11 81 | 82 | 83 | 84 | window 85 | 86 | 87 | 88 | 14 89 | 90 | 91 | 92 | 93 | YES 94 | 95 | 0 96 | 97 | 98 | 99 | 100 | 101 | -1 102 | 103 | 104 | File's Owner 105 | 106 | 107 | 3 108 | 109 | 110 | OBGradientViewDemo App Delegate 111 | 112 | 113 | -2 114 | 115 | 116 | 117 | 118 | 10 119 | 120 | 121 | 122 | 123 | 12 124 | 125 | 126 | 127 | 128 | 129 | 130 | YES 131 | 132 | YES 133 | -1.CustomClassName 134 | -2.CustomClassName 135 | 10.CustomClassName 136 | 10.IBEditorWindowLastContentRect 137 | 10.IBPluginDependency 138 | 12.IBEditorWindowLastContentRect 139 | 12.IBPluginDependency 140 | 3.CustomClassName 141 | 3.IBPluginDependency 142 | 143 | 144 | YES 145 | UIApplication 146 | UIResponder 147 | OBGradientViewDemoViewController 148 | {{234, 376}, {320, 480}} 149 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 150 | {{525, 346}, {320, 480}} 151 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 152 | OBGradientViewDemoAppDelegate 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | 155 | 156 | 157 | YES 158 | 159 | 160 | YES 161 | 162 | 163 | 164 | 165 | YES 166 | 167 | 168 | YES 169 | 170 | 171 | 172 | 14 173 | 174 | 175 | 176 | YES 177 | 178 | OBGradientViewDemoAppDelegate 179 | NSObject 180 | 181 | YES 182 | 183 | YES 184 | viewController 185 | window 186 | 187 | 188 | YES 189 | OBGradientViewDemoViewController 190 | UIWindow 191 | 192 | 193 | 194 | IBProjectSource 195 | Classes/OBGradientViewDemoAppDelegate.h 196 | 197 | 198 | 199 | OBGradientViewDemoAppDelegate 200 | NSObject 201 | 202 | IBUserSource 203 | 204 | 205 | 206 | 207 | OBGradientViewDemoViewController 208 | UIViewController 209 | 210 | IBProjectSource 211 | Classes/OBGradientViewDemoViewController.h 212 | 213 | 214 | 215 | 216 | 0 217 | IBCocoaTouchFramework 218 | 219 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 220 | 221 | 222 | YES 223 | OBGradientViewDemo.xcodeproj 224 | 3 225 | 81 226 | 227 | 228 | -------------------------------------------------------------------------------- /OBGradientViewDemo/OBGradientViewDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /OBGradientViewDemo/OBGradientViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* OBGradientViewDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* OBGradientViewDemoAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 15 | 2899E5220DE3E06400AC0155 /* OBGradientViewDemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* OBGradientViewDemoViewController.xib */; }; 16 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 17 | 28D7ACF80DDB3853001CB0EB /* OBGradientViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* OBGradientViewDemoViewController.m */; }; 18 | 5D1F149C117DC3F100B1065E /* OBGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D1F149B117DC3F100B1065E /* OBGradientView.m */; }; 19 | 5D1F14A2117DC59C00B1065E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1F14A1117DC59C00B1065E /* QuartzCore.framework */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 24 | 1D3623240D0F684500981E51 /* OBGradientViewDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBGradientViewDemoAppDelegate.h; sourceTree = ""; }; 25 | 1D3623250D0F684500981E51 /* OBGradientViewDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBGradientViewDemoAppDelegate.m; sourceTree = ""; }; 26 | 1D6058910D05DD3D006BFB54 /* OBGradientViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OBGradientViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 28 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 29 | 2899E5210DE3E06400AC0155 /* OBGradientViewDemoViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OBGradientViewDemoViewController.xib; sourceTree = ""; }; 30 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 31 | 28D7ACF60DDB3853001CB0EB /* OBGradientViewDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBGradientViewDemoViewController.h; sourceTree = ""; }; 32 | 28D7ACF70DDB3853001CB0EB /* OBGradientViewDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBGradientViewDemoViewController.m; sourceTree = ""; }; 33 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | 32CA4F630368D1EE00C91783 /* OBGradientViewDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBGradientViewDemo_Prefix.pch; sourceTree = ""; }; 35 | 5D1F149A117DC3F100B1065E /* OBGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBGradientView.h; sourceTree = ""; }; 36 | 5D1F149B117DC3F100B1065E /* OBGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBGradientView.m; sourceTree = ""; }; 37 | 5D1F14A1117DC59C00B1065E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 38 | 8D1107310486CEB800E47090 /* OBGradientViewDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OBGradientViewDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 47 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 48 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 49 | 5D1F14A2117DC59C00B1065E /* QuartzCore.framework in Frameworks */, 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXFrameworksBuildPhase section */ 54 | 55 | /* Begin PBXGroup section */ 56 | 080E96DDFE201D6D7F000001 /* Classes */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 5D1F1499117DC3F100B1065E /* OBGradientView */, 60 | 1D3623240D0F684500981E51 /* OBGradientViewDemoAppDelegate.h */, 61 | 1D3623250D0F684500981E51 /* OBGradientViewDemoAppDelegate.m */, 62 | 28D7ACF60DDB3853001CB0EB /* OBGradientViewDemoViewController.h */, 63 | 28D7ACF70DDB3853001CB0EB /* OBGradientViewDemoViewController.m */, 64 | ); 65 | path = Classes; 66 | sourceTree = ""; 67 | }; 68 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 1D6058910D05DD3D006BFB54 /* OBGradientViewDemo.app */, 72 | ); 73 | name = Products; 74 | sourceTree = ""; 75 | }; 76 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 080E96DDFE201D6D7F000001 /* Classes */, 80 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 81 | 29B97317FDCFA39411CA2CEA /* Resources */, 82 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 83 | 19C28FACFE9D520D11CA2CBB /* Products */, 84 | 5D1F14A1117DC59C00B1065E /* QuartzCore.framework */, 85 | ); 86 | name = CustomTemplate; 87 | sourceTree = ""; 88 | }; 89 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 32CA4F630368D1EE00C91783 /* OBGradientViewDemo_Prefix.pch */, 93 | 29B97316FDCFA39411CA2CEA /* main.m */, 94 | ); 95 | name = "Other Sources"; 96 | sourceTree = ""; 97 | }; 98 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 2899E5210DE3E06400AC0155 /* OBGradientViewDemoViewController.xib */, 102 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 103 | 8D1107310486CEB800E47090 /* OBGradientViewDemo-Info.plist */, 104 | ); 105 | name = Resources; 106 | sourceTree = ""; 107 | }; 108 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 112 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 113 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 114 | ); 115 | name = Frameworks; 116 | sourceTree = ""; 117 | }; 118 | 5D1F1499117DC3F100B1065E /* OBGradientView */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 5D1F149A117DC3F100B1065E /* OBGradientView.h */, 122 | 5D1F149B117DC3F100B1065E /* OBGradientView.m */, 123 | ); 124 | name = OBGradientView; 125 | path = ../OBGradientView; 126 | sourceTree = SOURCE_ROOT; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 1D6058900D05DD3D006BFB54 /* OBGradientViewDemo */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "OBGradientViewDemo" */; 134 | buildPhases = ( 135 | 1D60588D0D05DD3D006BFB54 /* Resources */, 136 | 1D60588E0D05DD3D006BFB54 /* Sources */, 137 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = OBGradientViewDemo; 144 | productName = OBGradientViewDemo; 145 | productReference = 1D6058910D05DD3D006BFB54 /* OBGradientViewDemo.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | /* End PBXNativeTarget section */ 149 | 150 | /* Begin PBXProject section */ 151 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 152 | isa = PBXProject; 153 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "OBGradientViewDemo" */; 154 | compatibilityVersion = "Xcode 3.1"; 155 | hasScannedForEncodings = 1; 156 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 1D6058900D05DD3D006BFB54 /* OBGradientViewDemo */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 171 | 2899E5220DE3E06400AC0155 /* OBGradientViewDemoViewController.xib in Resources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXResourcesBuildPhase section */ 176 | 177 | /* Begin PBXSourcesBuildPhase section */ 178 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 179 | isa = PBXSourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 183 | 1D3623260D0F684500981E51 /* OBGradientViewDemoAppDelegate.m in Sources */, 184 | 28D7ACF80DDB3853001CB0EB /* OBGradientViewDemoViewController.m in Sources */, 185 | 5D1F149C117DC3F100B1065E /* OBGradientView.m in Sources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXSourcesBuildPhase section */ 190 | 191 | /* Begin XCBuildConfiguration section */ 192 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 193 | isa = XCBuildConfiguration; 194 | buildSettings = { 195 | ALWAYS_SEARCH_USER_PATHS = NO; 196 | COPY_PHASE_STRIP = NO; 197 | GCC_DYNAMIC_NO_PIC = NO; 198 | GCC_OPTIMIZATION_LEVEL = 0; 199 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 200 | GCC_PREFIX_HEADER = OBGradientViewDemo_Prefix.pch; 201 | INFOPLIST_FILE = "OBGradientViewDemo-Info.plist"; 202 | PRODUCT_NAME = OBGradientViewDemo; 203 | }; 204 | name = Debug; 205 | }; 206 | 1D6058950D05DD3E006BFB54 /* Release */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | COPY_PHASE_STRIP = YES; 211 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 212 | GCC_PREFIX_HEADER = OBGradientViewDemo_Prefix.pch; 213 | INFOPLIST_FILE = "OBGradientViewDemo-Info.plist"; 214 | PRODUCT_NAME = OBGradientViewDemo; 215 | VALIDATE_PRODUCT = YES; 216 | }; 217 | name = Release; 218 | }; 219 | C01FCF4F08A954540054247B /* Debug */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 224 | GCC_C_LANGUAGE_STANDARD = c99; 225 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 226 | GCC_WARN_UNUSED_VARIABLE = YES; 227 | PREBINDING = NO; 228 | SDKROOT = iphoneos3.1.3; 229 | }; 230 | name = Debug; 231 | }; 232 | C01FCF5008A954540054247B /* Release */ = { 233 | isa = XCBuildConfiguration; 234 | buildSettings = { 235 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 236 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 237 | GCC_C_LANGUAGE_STANDARD = c99; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 241 | PREBINDING = NO; 242 | SDKROOT = iphoneos3.1.3; 243 | }; 244 | name = Release; 245 | }; 246 | /* End XCBuildConfiguration section */ 247 | 248 | /* Begin XCConfigurationList section */ 249 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "OBGradientViewDemo" */ = { 250 | isa = XCConfigurationList; 251 | buildConfigurations = ( 252 | 1D6058940D05DD3E006BFB54 /* Debug */, 253 | 1D6058950D05DD3E006BFB54 /* Release */, 254 | ); 255 | defaultConfigurationIsVisible = 0; 256 | defaultConfigurationName = Release; 257 | }; 258 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "OBGradientViewDemo" */ = { 259 | isa = XCConfigurationList; 260 | buildConfigurations = ( 261 | C01FCF4F08A954540054247B /* Debug */, 262 | C01FCF5008A954540054247B /* Release */, 263 | ); 264 | defaultConfigurationIsVisible = 0; 265 | defaultConfigurationName = Release; 266 | }; 267 | /* End XCConfigurationList section */ 268 | }; 269 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 270 | } 271 | -------------------------------------------------------------------------------- /OBGradientViewDemo/OBGradientViewDemoViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10D573 6 | 762 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 87 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | 44 | YES 45 | 46 | 47 | 274 48 | {{20, 79}, {280, 274}} 49 | 50 | 51 | 1 52 | MC44MDAwMDAwMTE5IDAuODAwMDAwMDExOSAwLjgwMDAwMDAxMTkAA 53 | 54 | IBCocoaTouchFramework 55 | 56 | 57 | 58 | 290 59 | {{20, 20}, {280, 44}} 60 | 61 | NO 62 | IBCocoaTouchFramework 63 | 2 64 | 0 65 | 66 | YES 67 | Red 68 | Blue 69 | 70 | 71 | YES 72 | 73 | 74 | 75 | 76 | YES 77 | 78 | 79 | 80 | 81 | YES 82 | {0, 0} 83 | {0, 0} 84 | 85 | 86 | YES 87 | 88 | 89 | 90 | 91 | 92 | 93 | 266 94 | {{20, 361}, {280, 79}} 95 | 96 | NO 97 | YES 98 | 7 99 | NO 100 | IBCocoaTouchFramework 101 | Try rotating from portrait to landscape to see the autoresizing mask at work. This is one example where a view is more convenient to use than a layer. 102 | 103 | Helvetica 104 | 14 105 | 16 106 | 107 | 108 | 1 109 | MCAwIDAAA 110 | 111 | 112 | 1 113 | 10 114 | 0 115 | 116 | 117 | {320, 460} 118 | 119 | 120 | 1 121 | MSAxIDEAA 122 | 123 | NO 124 | 125 | IBCocoaTouchFramework 126 | 127 | 128 | 129 | 130 | YES 131 | 132 | 133 | view 134 | 135 | 136 | 137 | 7 138 | 139 | 140 | 141 | gradientView 142 | 143 | 144 | 145 | 10 146 | 147 | 148 | 149 | gradientControlDidChange: 150 | 151 | 152 | 13 153 | 154 | 11 155 | 156 | 157 | 158 | 159 | YES 160 | 161 | 0 162 | 163 | 164 | 165 | 166 | 167 | -1 168 | 169 | 170 | File's Owner 171 | 172 | 173 | -2 174 | 175 | 176 | 177 | 178 | 6 179 | 180 | 181 | YES 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 8 190 | 191 | 192 | 193 | 194 | 9 195 | 196 | 197 | 198 | 199 | 12 200 | 201 | 202 | 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | -1.CustomClassName 210 | -2.CustomClassName 211 | 12.IBPluginDependency 212 | 6.IBEditorWindowLastContentRect 213 | 6.IBPluginDependency 214 | 8.CustomClassName 215 | 8.IBPluginDependency 216 | 9.IBPluginDependency 217 | 218 | 219 | YES 220 | OBGradientViewDemoViewController 221 | UIResponder 222 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 223 | {{560, 351}, {320, 480}} 224 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 225 | OBGradientView 226 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 227 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 228 | 229 | 230 | 231 | YES 232 | 233 | 234 | YES 235 | 236 | 237 | 238 | 239 | YES 240 | 241 | 242 | YES 243 | 244 | 245 | 246 | 12 247 | 248 | 249 | 250 | YES 251 | 252 | OBGradientView 253 | UIView 254 | 255 | IBProjectSource 256 | ../OBGradientView/OBGradientView.h 257 | 258 | 259 | 260 | OBGradientViewDemoViewController 261 | UIViewController 262 | 263 | gradientControlDidChange: 264 | id 265 | 266 | 267 | gradientView 268 | OBGradientView 269 | 270 | 271 | IBProjectSource 272 | Classes/OBGradientViewDemoViewController.h 273 | 274 | 275 | 276 | 277 | YES 278 | 279 | NSObject 280 | 281 | IBFrameworkSource 282 | Foundation.framework/Headers/NSError.h 283 | 284 | 285 | 286 | NSObject 287 | 288 | IBFrameworkSource 289 | Foundation.framework/Headers/NSFileManager.h 290 | 291 | 292 | 293 | NSObject 294 | 295 | IBFrameworkSource 296 | Foundation.framework/Headers/NSKeyValueCoding.h 297 | 298 | 299 | 300 | NSObject 301 | 302 | IBFrameworkSource 303 | Foundation.framework/Headers/NSKeyValueObserving.h 304 | 305 | 306 | 307 | NSObject 308 | 309 | IBFrameworkSource 310 | Foundation.framework/Headers/NSKeyedArchiver.h 311 | 312 | 313 | 314 | NSObject 315 | 316 | IBFrameworkSource 317 | Foundation.framework/Headers/NSNetServices.h 318 | 319 | 320 | 321 | NSObject 322 | 323 | IBFrameworkSource 324 | Foundation.framework/Headers/NSObject.h 325 | 326 | 327 | 328 | NSObject 329 | 330 | IBFrameworkSource 331 | Foundation.framework/Headers/NSPort.h 332 | 333 | 334 | 335 | NSObject 336 | 337 | IBFrameworkSource 338 | Foundation.framework/Headers/NSRunLoop.h 339 | 340 | 341 | 342 | NSObject 343 | 344 | IBFrameworkSource 345 | Foundation.framework/Headers/NSStream.h 346 | 347 | 348 | 349 | NSObject 350 | 351 | IBFrameworkSource 352 | Foundation.framework/Headers/NSThread.h 353 | 354 | 355 | 356 | NSObject 357 | 358 | IBFrameworkSource 359 | Foundation.framework/Headers/NSURL.h 360 | 361 | 362 | 363 | NSObject 364 | 365 | IBFrameworkSource 366 | Foundation.framework/Headers/NSURLConnection.h 367 | 368 | 369 | 370 | NSObject 371 | 372 | IBFrameworkSource 373 | Foundation.framework/Headers/NSXMLParser.h 374 | 375 | 376 | 377 | NSObject 378 | 379 | IBFrameworkSource 380 | QuartzCore.framework/Headers/CAAnimation.h 381 | 382 | 383 | 384 | NSObject 385 | 386 | IBFrameworkSource 387 | QuartzCore.framework/Headers/CALayer.h 388 | 389 | 390 | 391 | NSObject 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIAccessibility.h 395 | 396 | 397 | 398 | NSObject 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UINibLoading.h 402 | 403 | 404 | 405 | NSObject 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UIResponder.h 409 | 410 | 411 | 412 | UIControl 413 | UIView 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIControl.h 417 | 418 | 419 | 420 | UILabel 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UILabel.h 425 | 426 | 427 | 428 | UIResponder 429 | NSObject 430 | 431 | 432 | 433 | UISearchBar 434 | UIView 435 | 436 | IBFrameworkSource 437 | UIKit.framework/Headers/UISearchBar.h 438 | 439 | 440 | 441 | UISearchDisplayController 442 | NSObject 443 | 444 | IBFrameworkSource 445 | UIKit.framework/Headers/UISearchDisplayController.h 446 | 447 | 448 | 449 | UISegmentedControl 450 | UIControl 451 | 452 | IBFrameworkSource 453 | UIKit.framework/Headers/UISegmentedControl.h 454 | 455 | 456 | 457 | UIView 458 | 459 | IBFrameworkSource 460 | UIKit.framework/Headers/UITextField.h 461 | 462 | 463 | 464 | UIView 465 | UIResponder 466 | 467 | IBFrameworkSource 468 | UIKit.framework/Headers/UIView.h 469 | 470 | 471 | 472 | UIViewController 473 | 474 | IBFrameworkSource 475 | UIKit.framework/Headers/UINavigationController.h 476 | 477 | 478 | 479 | UIViewController 480 | 481 | IBFrameworkSource 482 | UIKit.framework/Headers/UITabBarController.h 483 | 484 | 485 | 486 | UIViewController 487 | UIResponder 488 | 489 | IBFrameworkSource 490 | UIKit.framework/Headers/UIViewController.h 491 | 492 | 493 | 494 | 495 | 0 496 | IBCocoaTouchFramework 497 | 498 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 499 | 500 | 501 | YES 502 | OBGradientViewDemo.xcodeproj 503 | 3 504 | 87 505 | 506 | 507 | -------------------------------------------------------------------------------- /OBGradientViewDemo/OBGradientViewDemo_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'OBGradientViewDemo' target in the 'OBGradientViewDemo' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /OBGradientViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // OBGradientViewDemo 4 | // 5 | // Created by Ole Begemann on 20.04.10. 6 | // Copyright Ole Begemann 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | # OBGradientView 2 | 3 | OBGradientView is a simple UIView wrapper for [CAGradientLayer][CAGradientLayerReference]. It is a 4 | plain UIView whose layer is a CAGradientLayer. It is useful if using a view is more convenient than 5 | using a layer, e.g. because you want to use autoresizing masks. 6 | 7 | OBGradientView exposes all of the layer's gradient-related properties. The getters and setters just 8 | forward the calls to the layer so the syntax is just the same as for CAGradientLayer's properties itself. 9 | See the [documentation for CAGradientLayer][CAGradientLayerReference] for details. 10 | 11 | The one exception to this is the colors property: in addition to an array of CGColorRefs, it also accepts 12 | an array of UIColor objects. Likewise, the getter returns an array of UIColors. If you need CGColorRefs, 13 | access gradientLayer.colors instead. 14 | 15 | ![OBGradientViewDemo screenshot][screenshot] 16 | 17 | ## Credits 18 | 19 | Written by Ole Begemann 20 | [http://oleb.net/blog/2010/04/obgradientview-a-simple-uiview-wrapper-for-cagradientlayer/][Blog post] 21 | April, 2010 22 | 23 | 24 | ## MIT License 25 | 26 | Copyright (c) 2010 Ole Begemann 27 | 28 | Permission is hereby granted, free of charge, to any person obtaining a copy 29 | of this software and associated documentation files (the "Software"), to deal 30 | in the Software without restriction, including without limitation the rights 31 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 | copies of the Software, and to permit persons to whom the Software is 33 | furnished to do so, subject to the following conditions: 34 | 35 | The above copyright notice and this permission notice shall be included in 36 | all copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 40 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 42 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 43 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 44 | THE SOFTWARE. 45 | 46 | [CAGradientLayerReference]: http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CAGradientLayer_class/Reference/Reference.html "CAGradientLayer Class Reference" 47 | [Blog post]: http://oleb.net/blog/2010/04/obgradientview-a-simple-uiview-wrapper-for-cagradientlayer/ 48 | [screenshot]: http://github.com/ole/OBGradientView/raw/master/OBGradientViewDemo-screenshot.png --------------------------------------------------------------------------------