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
// | |
// TransitionZoomForward.swift | |
// Created by Alex Gibson on 3/14/15. | |
// Free to Use by Anyone | |
// Have Fun! | |
// | |
import UIKit | |
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
// I have used this with PSPDFTextView | |
- (void)drawRect:(CGRect)rect { | |
[super drawRect:rect]; | |
//Get the current drawing context | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
//Set the line color and width | |
CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.2f].CGColor); | |
CGContextSetLineWidth(context, 1.0f); |
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
// when setting up your attributed String add an ATTRIBUTE to look for | |
// in this example button | |
// when i set up the string for the button I might use this | |
[NSForegroundColorAttributeName : UIColor.lightGrayColor(),NSFontAttributeName: font,"button":"button"] | |
func handleTapOnTextView(sender:UITextView){ | |
let storedAttributedString = self.textView.attributedText | |
let textView = sender.view as! UITextView |
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
let vw = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 50)) | |
vw.backgroundColor = UIColor.red | |
self.view.addSubview(vw) | |
vw.center = self.view.center | |
// Your code with delay | |
let spring = CASpringAnimation(keyPath: "position.y") | |
spring.toValue = vw.center.y - 200 | |
spring.damping = 10.0 |
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
import Cocoa | |
class ViewController: NSViewController,NSCollectionViewDelegate,NSCollectionViewDataSource,NSCollectionViewDelegateFlowLayout { | |
private let concurrentQueue = DispatchQueue(label: "calendarQueue", attributes: .concurrent) | |
//next 2 variables or speed and smoothness in loading | |
private var currentSection : Int! | |
private var currentOffset = 0 | |
private let calendar = Calendar.current |
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
call in viewDidLoad | |
setUpNavBar(bottomBorderColor: .white, opacity: 0.4, height: 1) | |
func setUpNavBar(bottomBorderColor:UIColor,opacity:Float,height:CGFloat){ | |
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) | |
let navLabel = UILabel(frame: CGRect.zero) | |
navLabel.backgroundColor = UIColor.clear | |
navLabel.font = UIFont.systemFont(ofSize: 18) | |
navLabel.textAlignment = NSTextAlignment.center |
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
#import "SettingsViewController.h" | |
#import "HomeViewController.h" | |
#import "AppDelegate.h" | |
#import "Location+CoreDataClass.h" | |
#import "LocationManager.h" | |
#import "DarkSkyAPI.h" | |
@interface SettingsViewController ()<UISearchBarDelegate> |
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
import UIKit | |
@IBDesignable class PulseTouchCollectionViewCell: UICollectionViewCell { | |
@IBInspectable var scaleFactor : CGFloat = 1.3 | |
@IBInspectable var animationColor : UIColor = UIColor.green | |
@IBInspectable var startingOpacity : Float = 0.2 | |
@IBInspectable var animationDuration : Double = 0.8 | |
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
CATransaction.begin() | |
let animation = CABasicAnimation(keyPath: "position") | |
animation.toValue = NSValue(cgPoint: CGPoint(x: self.view.bounds.width - 100, y: self.view.bounds.height - 100)) | |
animation.fromValue = NSValue(cgPoint: position) | |
animation.duration = 5 | |
animation.isRemovedOnCompletion = false | |
animation.fillMode = kCAFillModeForwards | |
CATransaction.setCompletionBlock({ | |
self.airplane.layer.position = CGPoint(x: self.view.bounds.width - 100, y: self.view.bounds.height - 100) |
OlderNewer