- Fix
- upgrade Pods
This commit is contained in:
1 parent
1797083a99
commit
4936fcd2ec
131 files changed
+2426
-2093
No files matched your search
Generated
+22
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 lanserxt
|
||||
|
||||
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.
|
||||
|
||||
Generated
+28
@@ -0,0 +1,28 @@
|
||||
UIView-Overlay
|
||||
===============
|
||||
|
||||
Plain and simple UIView category that adds overlay layer with specific color the the sublayers of the UIView.
|
||||
|
||||
##Requirements
|
||||
|
||||
* Xcode 5 (or higher)
|
||||
* Apple LLVM compiler
|
||||
* ARC
|
||||
* iOS 6.1 (or higher)
|
||||
|
||||
##Installation
|
||||
|
||||
Recommended way to install AGToggleFieldSetView is via [CocoaPods](http://cocoapods.org/). Add the following line to your Podfile:
|
||||
|
||||
```ruby
|
||||
pod 'UIView-Overlay'
|
||||
```
|
||||
|
||||
##Usage
|
||||
|
||||
Just call methods methods to add or remove the overlay
|
||||
|
||||
```objc
|
||||
[view ag_addOverlayWithColor: [[UIColor blackColor] colorWithAlphaComponent: 0.3]];
|
||||
[view ag_removeOverlay];
|
||||
```
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// UIView+Overlay.h
|
||||
// Strannik
|
||||
//
|
||||
// Created by Anton Gubarenko on 03.07.15.
|
||||
// Copyright (c) 2015 Anton Gubarenko. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIView (Overlay)
|
||||
|
||||
- (void) ag_addOverlayWithColor: (UIColor*) color;
|
||||
- (void) ag_addOverlayToTheBackWithColor: (UIColor*) color;
|
||||
- (void) ag_removeOverlay;
|
||||
|
||||
@end
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// UIView+Overlay.m
|
||||
// Strannik
|
||||
//
|
||||
// Created by Anton Gubarenko on 03.07.15.
|
||||
// Copyright (c) 2015 Anton Gubarenko. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIView+Overlay.h"
|
||||
|
||||
static const NSInteger kOverlayTag = 1001;
|
||||
static NSString* const kOverlayKey = @"kOverlayKey";
|
||||
|
||||
@implementation UIView (Overlay)
|
||||
|
||||
- (void) ag_addOverlayWithColor: (UIColor*) color
|
||||
{
|
||||
CALayer *overlay = [self ag_layer];
|
||||
if (!overlay)
|
||||
{
|
||||
CALayer *overlayLayer = [CALayer layer];
|
||||
overlayLayer.frame = self.frame;
|
||||
[overlayLayer setValue: [NSNumber numberWithInt: kOverlayTag]
|
||||
forKey: kOverlayKey];
|
||||
[overlayLayer setBackgroundColor: color.CGColor];
|
||||
[self.layer addSublayer: overlayLayer];
|
||||
}
|
||||
else
|
||||
{
|
||||
[overlay setBackgroundColor: color.CGColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) ag_addOverlayToTheBackWithColor: (UIColor*) color
|
||||
{
|
||||
CALayer *overlay = [self ag_layer];
|
||||
if (!overlay)
|
||||
{
|
||||
CALayer *overlayLayer = [CALayer layer];
|
||||
overlayLayer.frame = self.frame;
|
||||
[overlayLayer setValue: [NSNumber numberWithInt: kOverlayTag]
|
||||
forKey: kOverlayKey];
|
||||
[overlayLayer setBackgroundColor: color.CGColor];
|
||||
[self.layer insertSublayer: overlayLayer
|
||||
atIndex: 0 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
[overlay setBackgroundColor: color.CGColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (CALayer*) ag_layer
|
||||
{
|
||||
for (CALayer *subLayer in [self.layer sublayers])
|
||||
{
|
||||
if ([subLayer valueForKey: kOverlayKey])
|
||||
{
|
||||
return subLayer;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) ag_removeOverlay
|
||||
{
|
||||
CALayer *overlay = [self ag_layer];
|
||||
if (overlay)
|
||||
{
|
||||
[overlay removeFromSuperlayer];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) layoutSubviews
|
||||
{
|
||||
for (CALayer *subLayer in [self.layer sublayers])
|
||||
{
|
||||
if ([subLayer valueForKey: kOverlayKey])
|
||||
{
|
||||
subLayer.frame = self.frame;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user