Created
April 24, 2019 14:37
-
-
Save ekurutepe/e00ec0fc6581ba3bc21ced075fa2abeb to your computer and use it in GitHub Desktop.
UITableView with flipped y-axis to easy scroll to bottom.
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
// | |
// 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