mirror of
https://github.com/nerdycat/Cupcake.git
synced 2024-10-26 14:17:13 +03:00
fixed bugs on iOS 8
This commit is contained in:
parent
b5fef0e338
commit
ec5c88e7b3
@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "Cupcake"
|
||||
s.version = "1.0.0"
|
||||
s.version = "1.1.0"
|
||||
s.summary = "An easy way to create and layout UI components for iOS."
|
||||
|
||||
s.description = <<-DESC
|
||||
|
@ -26,10 +26,12 @@ import UIKit
|
||||
*/
|
||||
|
||||
public var Alert: AlertMaker {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return AlertMaker(style: .alert)
|
||||
}
|
||||
|
||||
public var ActionSheet: AlertMaker {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return AlertMaker(style: .actionSheet)
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
public var Button: UIButton {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let button = UIButton()
|
||||
cpk_higherHuggingAndResistance(forView: button)
|
||||
return button
|
||||
|
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
public var ImageView: UIImageView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let imageView = UIImageView()
|
||||
cpk_higherHuggingAndResistance(forView: imageView)
|
||||
return imageView
|
||||
|
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
public var Label: UILabel {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let label = UILabel()
|
||||
return label
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ public enum CPKStackAlignment : Int {
|
||||
*/
|
||||
|
||||
public func HStack(_ items: Any...) -> CPKStackView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let stack = CPKStackView()
|
||||
stack.axis = .horizontal
|
||||
stack.alignment = .center
|
||||
@ -76,6 +77,7 @@ public func HStack(_ items: Any...) -> CPKStackView {
|
||||
}
|
||||
|
||||
public func VStack(_ items: Any...) -> CPKStackView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let stack = CPKStackView()
|
||||
stack.axis = .vertical
|
||||
stack.alignment = .left
|
||||
|
@ -36,20 +36,24 @@ import UIKit
|
||||
*/
|
||||
|
||||
public func PlainTable(_ sectionsOrRows: Any...) -> StaticTableView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let tableView = StaticTableView(sectionsOrRows: sectionsOrRows, style: .plain)
|
||||
tableView.tableFooterView = UIView()
|
||||
return tableView
|
||||
}
|
||||
|
||||
public func GroupTable(_ sectionsOrRows: Any...) -> StaticTableView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return StaticTableView(sectionsOrRows: sectionsOrRows, style: .grouped)
|
||||
}
|
||||
|
||||
public func Section(_ rowsOrStrings: Any...) -> StaticSection {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return StaticSection(rowsOrStrings: rowsOrStrings)
|
||||
}
|
||||
|
||||
public var Row: StaticRow {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return StaticRow()
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
public var TextField: UITextField {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let textField = UITextField()
|
||||
textField.enablesReturnKeyAutomatically = true
|
||||
textField.returnKeyType = .done
|
||||
|
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
public var TextView: UITextView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return UITextView().font(17)
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
public var View: UIView {
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
let view = UIView()
|
||||
return view
|
||||
}
|
||||
|
@ -601,28 +601,31 @@ extension NSMutableAttributedString {
|
||||
|
||||
fileprivate var __flagForMethodSwizzle__: Bool = false
|
||||
|
||||
func cpk_swizzleMethodsIfNeed() {
|
||||
if !__flagForMethodSwizzle__ {
|
||||
__flagForMethodSwizzle__ = true
|
||||
|
||||
UIView.cpk_swizzle(method1: "setBounds:",
|
||||
method2: #selector(UIView.cpk_setBounds))
|
||||
UIView.cpk_swizzle(method1: #selector(UIView.point(inside:with:)),
|
||||
method2: #selector(UIView.cpk_point(inside:with:)))
|
||||
|
||||
UILabel.cpk_swizzle(method1: #selector(setter: UILabel.text),
|
||||
method2: #selector(UILabel.ner_setText(_:)))
|
||||
|
||||
|
||||
UITextField.cpk_swizzle(method1: #selector(UITextField.textRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_textRect(forBounds:)))
|
||||
UITextField.cpk_swizzle(method1: #selector(UITextField.editingRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_editingRect(forBounds:)))
|
||||
|
||||
UITextView.cpk_swizzle(method1: "dealloc", method2: #selector(UITextView.cpk_deinit))
|
||||
}
|
||||
}
|
||||
|
||||
extension UIApplication {
|
||||
open override var next: UIResponder? {
|
||||
if !__flagForMethodSwizzle__ {
|
||||
__flagForMethodSwizzle__ = true
|
||||
|
||||
UIView.cpk_swizzle(method1: "setBounds:",
|
||||
method2: #selector(UIView.cpk_setBounds))
|
||||
UIView.cpk_swizzle(method1: #selector(UIView.point(inside:with:)),
|
||||
method2: #selector(UIView.cpk_point(inside:with:)))
|
||||
|
||||
UILabel.cpk_swizzle(method1: #selector(setter: UILabel.text),
|
||||
method2: #selector(UILabel.ner_setText(_:)))
|
||||
|
||||
|
||||
UITextField.cpk_swizzle(method1: #selector(UITextField.textRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_textRect(forBounds:)))
|
||||
UITextField.cpk_swizzle(method1: #selector(UITextField.editingRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_editingRect(forBounds:)))
|
||||
|
||||
UITextView.cpk_swizzle(method1: "dealloc", method2: #selector(UITextView.cpk_deinit))
|
||||
}
|
||||
|
||||
cpk_swizzleMethodsIfNeed()
|
||||
return super.next
|
||||
}
|
||||
}
|
||||
@ -1901,7 +1904,7 @@ public class StaticRow: UIView {
|
||||
}
|
||||
|
||||
public override class var layerClass: Swift.AnyClass {
|
||||
return CATransformLayer.self
|
||||
return CPKTransformLayer.self
|
||||
}
|
||||
|
||||
func switchDidChange() {
|
||||
|
Loading…
Reference in New Issue
Block a user