Created
August 28, 2015 14:58
-
-
Save christophercotton/67a6f02c10d96a954c5c to your computer and use it in GitHub Desktop.
Debug versions of views which can be used to track down positioning issues
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
// DebugViews.swift | |
// Created by Christopher Cotton, no copyright | |
import UIKit | |
class DebugView: UIView { | |
override var bounds: CGRect { | |
didSet { | |
println("Bounds Changed: \(bounds)") | |
} | |
} | |
override var center: CGPoint { | |
didSet { | |
println("center Changed: \(center)") | |
} | |
} | |
override var frame: CGRect { | |
didSet { | |
println("frame Changed: \(frame)") | |
} | |
} | |
} | |
class DebugLabelView : UILabel { | |
override var bounds: CGRect { | |
didSet { | |
println("Bounds Changed: \(bounds)") | |
font = font.fontWithSize(bounds.height - 1) | |
} | |
} | |
override var center: CGPoint { | |
didSet { | |
println("center Changed: \(center)") | |
} | |
} | |
override var frame: CGRect { | |
didSet { | |
println("frame Changed: \(frame)") | |
} | |
} | |
} | |
class DebugTableView: UITableView { | |
override var bounds: CGRect { | |
didSet { | |
println("\(self) Bounds Changed: \(bounds)") | |
} | |
} | |
override var center: CGPoint { | |
didSet { | |
println("\(self) center Changed: \(center)") | |
} | |
} | |
override var contentInset: UIEdgeInsets { | |
didSet { | |
println("\(self) contentInset Changed: \(contentInset.top)") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment