Skip to content

Instantly share code, notes, and snippets.

View therohansanap's full-sized avatar
🎯
Focusing

Rohan Dilip Sanap therohansanap

🎯
Focusing
View GitHub Profile
@cybertk
cybertk / UITableView+ClearSelections.swift
Created August 20, 2015 08:34
Clear all selections of UITableView
//
// UITableView+ClearSelections.swift
// Cybertk
//
// Created by Quanlong He on 8/20/15.
// Copyright © 2015 Quanlong He. All rights reserved.
//
import Foundation
@JeOam
JeOam / Animation.md
Last active February 11, 2026 10:31
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

@ynechaev
ynechaev / gist:8123997
Last active June 9, 2017 23:18
UITableViewCell popular animation (flipping around Y axis, depending on scroll direction)
@interface YourViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
UIImageOrientation scrollOrientation;
CGPoint lastPos;
}
- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView.isDragging) {
UIView *myView = cell.contentView;
CALayer *layer = myView.layer;
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
@alloy
alloy / gist:5460654
Last active July 18, 2020 22:02
UICollectionViewFlowLayout subclass to vertically align cells at the bottom edge.
@interface MTLibraryCollectionViewFlowLayout : UICollectionViewFlowLayout
@end