This file contains hidden or 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
// | |
// DeallocationChecker.swift | |
// DeallocationChecker | |
// | |
// Created by Arkadiusz Holko on {TODAY}. | |
// Copyright © 2017 DeallocationChecker. All rights reserved. | |
// | |
import UIKit | |
extension UIViewController { |
This file contains hidden or 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
- (void)drawGradientWithContext:(CGContextRef)context colors:(NSArray <id> *)colors path:(CGPathRef)path | |
aplha:(CGFloat)alpha startPointY:(CGFloat)startY { | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGFloat locations[] = {0.0, 1.0}; | |
CGContextSaveGState(context); | |
CGContextAddPath(context, path); | |
CGContextClip(context); |
This file contains hidden or 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
- (void)layoutSubviews { | |
[super layoutSubviews]; | |
if (self.shouldAnimateShadowPath) { | |
CAAnimation *animation = [self.layer animationForKey:@"bounds.size"]; | |
if (animation) { | |
// 通过CABasicAnimation类来为shadowPath添加动画 | |
CABasicAnimation *shadowPathAnimation = [CABasicAnimation animationWithKeyPath:@"shadowPath"]; | |
// 根据bounds的动画属性设置shadowPath的动画属性 | |
shadowPathAnimation.timingFunction = animation.timingFunction; | |
shadowPathAnimation.duration = animation.duration; |
This file contains hidden or 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
import UIKit | |
private weak var currentFirstResponder: AnyObject? | |
extension UIResponder { | |
@objc func findFirstResponder() -> AnyObject? { | |
currentFirstResponder = nil | |
UIApplication.shared.sendAction(#selector(findFirstResponder(_:)), to: nil, from: self, for: nil) | |
return currentFirstResponder | |
} |
This file contains hidden or 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
OBJC_PRINT_REPLACED_METHODS | |
DYLD_PRINT_STATISTICS | |
OS_ACTIVITY_MODE |
This file contains hidden or 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
- (void)musicAnimation { | |
CAReplicatorLayer *r = [[CAReplicatorLayer alloc] init]; | |
r.bounds = (CGRect){0,0,60,60}; | |
r.position = self.view.center; | |
[self.view.layer addSublayer:r]; | |
CALayer *bar = [[CALayer alloc] init]; | |
bar.bounds = CGRectMake(0, 0, 8, 40); | |
bar.position = CGPointMake(10, 75); |
This file contains hidden or 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
[UIView transitionWithView:_animatedLabel duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ _animatedLabel.textColor = colorChanged?[UIColor greenColor]:[UIColor blackColor]; } completion:^(BOOL finished) { }]; |
This file contains hidden or 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
[self.navigationController.navigationBar setTranslucent:NO]; | |
[navigationBar setBackgroundImage:[UIImage imageNamed:@“NavigaionBarBackground”] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; | |
[navigationBar setShadowImage:[UIImage new]]; | |
ToolBar.clipToBounds = YES; |
This file contains hidden or 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
CATransition *animation = [CATransition animation]; | |
animation.duration = 0.5; | |
animation.type = kCATransitionFade; | |
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
[self.navigationController.navigationBar.layer addAnimation:animation forKey:@"changeTextTransition"]; | |
self.title = title; |
This file contains hidden or 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
class Once { | |
static let run: Void = { | |
print(“code execute”) | |
}() | |
} |