Skip to content

Instantly share code, notes, and snippets.

@ekurutepe
Created April 24, 2019 14:37
Show Gist options
  • Save ekurutepe/e00ec0fc6581ba3bc21ced075fa2abeb to your computer and use it in GitHub Desktop.
Save ekurutepe/e00ec0fc6581ba3bc21ced075fa2abeb to your computer and use it in GitHub Desktop.
UITableView with flipped y-axis to easy scroll to bottom.
//
// FlippedTableView.swift
// translate
//
// Created by Engin Kurutepe on 26.12.18.
// Copyright © 2018 Fifteen Jugglers Software UG. All rights reserved.
//
import UIKit
class FlippedTableView: UITableView {
override func dequeueReusableCell(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCell {
let cell = super.dequeueReusableCell(withIdentifier: identifier, for: indexPath)
cell.transform = CGAffineTransform(scaleX: 1.0, y: -1.0)
return cell
}
override func layoutSubviews() {
super.layoutSubviews()
for subview in subviews {
if NSStringFromClass(type(of: subview)) == "UISwipeActionPullView" {
subview.transform = CGAffineTransform(scaleX: 1.0, y: -1.0)
}
}
}
override func didMoveToSuperview() {
super.didMoveToSuperview()
self.transform = CGAffineTransform(scaleX: 1.0, y: -1.0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment