• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple UIView wrapper for CAGradientLayer. For the times when it's more convenient to use a view instead of a CALayer.

OBGradientView

OBGradientView is a simple UIView wrapper for CAGradientLayer. It is a plain UIView whose layer is a CAGradientLayer. It is useful if using a view is more convenient than using a layer, e.g. because you want to use autoresizing masks.

OBGradientView exposes all of the layer's gradient-related properties. The getters and setters just forward the calls to the layer so the syntax is just the same as for CAGradientLayer's properties itself. See the documentation for CAGradientLayer for details.

The one exception to this is the colors property: in addition to an array of CGColorRefs, it also accepts an array of UIColor objects. Likewise, the getter returns an array of UIColors. If you need CGColorRefs, access gradientLayer.colors instead.

OBGradientViewDemo screenshot

Credits

Written by Ole Begemann
http://oleb.net/blog/2010/04/obgradientview-a-simple-uiview-wrapper-for-cagradientlayer/
April, 2010

MIT License

Copyright (c) 2010 Ole Begemann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

whats-new-in-swift-4

An Xcode playground showcasing the new features in Swift 4.0.
Swift
1,827
star
2

OBShapedButton

A UIButton subclass that works with for non-rectangular button shapes.
Objective-C
946
star
3

whats-new-in-swift-4-2

An Xcode playground demonstrating the new features in in Swift 4.2.
Swift
872
star
4

OLEContainerScrollView

A UIScrollView subclass that intelligently handles multiple child scroll views and does not interfere with UIKitʼs cell reuse functionality.
Objective-C
588
star
5

Animated-Paths

Demo project: Animating the drawing of a CGPath with CAShapeLayer.strokeEnd
Objective-C
505
star
6

swiftui-view-lifecycle

Observe how different SwiftUI container views affect state and lifecycle events (onAppear, onDisappear).
Swift
374
star
7

OBSlider

A UISlider subclass that adds variable scrubbing speeds (as seen in the Music app on iOS).
Objective-C
267
star
8

CollectionViewParallaxScrolling

A custom UICollectionViewFlowLayout to support parallax scrolling in cells. Check out the accompanying blog post for more info.
Objective-C
250
star
9

Ampere

Adding multiplication and division to the units of measurement types in Foundation.
Swift
171
star
10

swiftui-layout-inspector

A tool for learning how the SwiftUI layout system works, and for debugging your own layout code.
Swift
168
star
11

SortedArray

An array that keeps its elements sorted according to a given sort predicate.
Swift
165
star
12

CustomScrollView

A very simple implementation of a scroll view on iOS. Not meant for production, just for learning purposes. Please check out the accompanying blog post.
Objective-C
154
star
13

NSBundle-OBCodeSigningInfo

Check an app bundle's code signing and sandboxing state to NSBundle.
Objective-C
106
star
14

swift-rp-pico-bare

Embedded Swift on the Raspberry Pi Pico without the Pico C/C++ SDK
C
93
star
15

Storyboard-Strings-Extraction

Automatically extract translatable strings from Xcode storyboards and update .strings files.
Shell
74
star
16

SilentPush

An iOS test app for testing silent push notifications and background fetching.
Swift
71
star
17

CGPathHitTesting

A demo iOS app to illustrate hit testing with CGPathCreateCopyByStrokingPath()
Objective-C
71
star
18

pico-embedded-swift

Embedded Swift on the Raspberry Pi Pico
CMake
62
star
19

AppointmentList

Sample iOS app that lists events from the device's calendar store in a table view and groups them by date.
Objective-C
48
star
20

RemoteViewControllers

Introspection of the private and undocumented remote view controllers feature in iOS 6
Objective-C
45
star
21

iphone-6-plus-rendering

Quick and dirty test apps to understand how the built-in downsampling to screen resolution works on the iPhone 6 Plus.
Swift
44
star
22

GestureRecognition

Sample iOS app for a blog post about gesture recognition and attention to detail
Objective-C
42
star
23

itunesconnect-financialreports

Converts Financial Reports from iTunes Connect (App Store) to HTML
Ruby
37
star
24

OSLogStoreTest

Test app for evaluating if apps can access their own OSLog logs via OSLogStore.
Swift
30
star
25

AnalogDial

A circular analog dial that can display a numeric value in a specified range (like an analog speedometer).
Swift
24
star
26

AppleCoreDataModels

21
star
27

NotificationUnregistering

Testing the behavior of the block based NotificationCenter API. Do you have to call NotificationCenter.removeObserver(_:) or is it enough to let the observer token go out of scope? Turns out: the former (tested on iOS 11.2).
Swift
16
star
28

ConcurrencyBenchmark

Swift
15
star
29

HexHexHex

A parser for the Intel Hexadecimal Object File Format (.hex), written in Swift.
Swift
14
star
30

Kaffeekasse

Sample apps for a Passbook tutorial on my blog.
C++
14
star
31

transcribe

A Swift parser for output files from automated transcription services. An experiment inspired by the Swift Community Podcast.
Swift
13
star
32

Picobello

An assembler for the Microchip PIC instruction set, written in Swift.
Swift
13
star
33

topaz

An attempt to reimplement a minimal version of the Swift standard library. Just for fun — I doubt this has practical applications.
Swift
12
star
34

RGBtoCMYK

A simple command-line Cocoa app to convert images to CMYK
Objective-C
10
star
35

SwiftUI-Mac-Focus

Test project for playing with focus, keyboard shortcuts, menu commands in SwiftUI on the Mac
Swift
10
star
36

CAShapeLayer-Animation

Demo project for a Stack Overflow question: "Animate CAShapeLayer path on animated bounds change"
Objective-C
9
star
37

Funtime

A Swift interface for the Objective-C Runtime API
Swift
8
star
38

CollectionViewContentSizeAnimation

Demo project for a Stack Overflow question.
Objective-C
8
star
39

SwiftPM-embedded-minimal

Swift
6
star
40

OBStack

OBStack is a very simple implementation of a stack data structure (last in, first out) in Cocoa.
Objective-C
5
star
41

AsyncSequenceOperators

Experimental reimplementations of functional reactive operators for AsyncSequence. DO NOT USE IN PRODUCTION!
Swift
5
star
42

AsyncXMLParsing

An AsyncSequence wrapper for Foundation’s XMLParser (experimental)
Swift
4
star
43

SwiftUIAnimationBug

https://twitter.com/olebegemann/status/1587912494290444290
Swift
3
star
44

twitter-backup

A Ruby script to backup tweets (in the raw JSON format)
Ruby
3
star
45

rust-rp-pico-template

A cargo-generate template for embedded Rust development on the Raspberry Pi Pico.
Rust
2
star
46

docopt.objc

Incomplete beginnings of an implementation of the docopt language in Objective-C.
Objective-C
2
star
47

CoreDataDebugging

Swift
2
star
48

SetSolver

A solver for the card game Set.
Swift
1
star
49

SwiftConcurrencyDeadlock

Swift
1
star