-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
176 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# SAMGradientView | ||
|
||
Easily use gradients in UIKit. SAMGradientView is a simple UIView wrapper around CGGradient. | ||
|
||
SAMGradientView is tested on iOS 6 and requires ARC. Released under the [MIT license](LICENSE). | ||
|
||
## Example | ||
|
||
![Screenshot](http://soff.me/PzUc/iOS%20Simulator%20Screen%20shot%20Jun%2030,%202013%205.30.40%20PM.png) | ||
|
||
Open up the included Xcode project for an example app and the tests. | ||
|
||
## Usage | ||
|
||
``` objc | ||
// Initialize a gradient view | ||
SAMGradientView *gradientView = [[SAMGradientView alloc] initWithFrame:CGRectMake(20.0f, 20.0f, 280.0f, 280.0f)]; | ||
|
||
// Set the gradient colors | ||
gradientView.gradientColors = @[[UIColor greenColor], [UIColor yellowColor]]; | ||
|
||
// Optionally set some locations | ||
gradientView.gradientLocations = @[@0.8, @1.0]; | ||
|
||
// Optionally change the direction. The default is vertical. | ||
gradientView.gradientDirection = SAMGradientViewDirectionHorizontal; | ||
|
||
// Add some borders too if you want | ||
gradientView.topBorderColor = [UIColor redColor]; | ||
gradientView.bottomBorderColor = [UIColor blueColor]; | ||
|
||
// Add it as a subview in all of its awesome | ||
[self.view addSubview:gradientView]; | ||
``` | ||
See the [header](SAMGradientView/SAMGradientView.h) for full documentation. | ||
## Installation | ||
Simply add the files in the `SAMGradientView.h` and `SAMGradientView.m` to your project or add `SAMGradientView` to your Podfile if you're using CocoaPods. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'SAMGradientView' | ||
s.version = '0.1.0' | ||
s.authors = {'Sam Soffes' => '[email protected]'} | ||
s.homepage = 'https://github.com/soffes/SAMGradientView' | ||
s.summary = 'Easily use gradients in UIKit.' | ||
s.source = {:git => 'https://github.com/soffes/SAMGradientView.git', :tag => 'v0.1.0'} | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
|
||
s.platform = :ios | ||
s.requires_arc = true | ||
s.frameworks = 'UIKit', 'CoreGraphics' | ||
s.source_files = 'SAMGradientView' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters