mirror of
https://github.com/nerdycat/Cupcake.git
synced 2024-09-11 13:07: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|
|
Pod::Spec.new do |s|
|
||||||
|
|
||||||
s.name = "Cupcake"
|
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.summary = "An easy way to create and layout UI components for iOS."
|
||||||
|
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
|
@ -26,10 +26,12 @@ import UIKit
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public var Alert: AlertMaker {
|
public var Alert: AlertMaker {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
return AlertMaker(style: .alert)
|
return AlertMaker(style: .alert)
|
||||||
}
|
}
|
||||||
|
|
||||||
public var ActionSheet: AlertMaker {
|
public var ActionSheet: AlertMaker {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
return AlertMaker(style: .actionSheet)
|
return AlertMaker(style: .actionSheet)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public var Button: UIButton {
|
public var Button: UIButton {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let button = UIButton()
|
let button = UIButton()
|
||||||
cpk_higherHuggingAndResistance(forView: button)
|
cpk_higherHuggingAndResistance(forView: button)
|
||||||
return button
|
return button
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public var ImageView: UIImageView {
|
public var ImageView: UIImageView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let imageView = UIImageView()
|
let imageView = UIImageView()
|
||||||
cpk_higherHuggingAndResistance(forView: imageView)
|
cpk_higherHuggingAndResistance(forView: imageView)
|
||||||
return imageView
|
return imageView
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public var Label: UILabel {
|
public var Label: UILabel {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
return label
|
return label
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ public enum CPKStackAlignment : Int {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public func HStack(_ items: Any...) -> CPKStackView {
|
public func HStack(_ items: Any...) -> CPKStackView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let stack = CPKStackView()
|
let stack = CPKStackView()
|
||||||
stack.axis = .horizontal
|
stack.axis = .horizontal
|
||||||
stack.alignment = .center
|
stack.alignment = .center
|
||||||
@ -76,6 +77,7 @@ public func HStack(_ items: Any...) -> CPKStackView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func VStack(_ items: Any...) -> CPKStackView {
|
public func VStack(_ items: Any...) -> CPKStackView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let stack = CPKStackView()
|
let stack = CPKStackView()
|
||||||
stack.axis = .vertical
|
stack.axis = .vertical
|
||||||
stack.alignment = .left
|
stack.alignment = .left
|
||||||
|
@ -36,20 +36,24 @@ import UIKit
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public func PlainTable(_ sectionsOrRows: Any...) -> StaticTableView {
|
public func PlainTable(_ sectionsOrRows: Any...) -> StaticTableView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let tableView = StaticTableView(sectionsOrRows: sectionsOrRows, style: .plain)
|
let tableView = StaticTableView(sectionsOrRows: sectionsOrRows, style: .plain)
|
||||||
tableView.tableFooterView = UIView()
|
tableView.tableFooterView = UIView()
|
||||||
return tableView
|
return tableView
|
||||||
}
|
}
|
||||||
|
|
||||||
public func GroupTable(_ sectionsOrRows: Any...) -> StaticTableView {
|
public func GroupTable(_ sectionsOrRows: Any...) -> StaticTableView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
return StaticTableView(sectionsOrRows: sectionsOrRows, style: .grouped)
|
return StaticTableView(sectionsOrRows: sectionsOrRows, style: .grouped)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func Section(_ rowsOrStrings: Any...) -> StaticSection {
|
public func Section(_ rowsOrStrings: Any...) -> StaticSection {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
return StaticSection(rowsOrStrings: rowsOrStrings)
|
return StaticSection(rowsOrStrings: rowsOrStrings)
|
||||||
}
|
}
|
||||||
|
|
||||||
public var Row: StaticRow {
|
public var Row: StaticRow {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
return StaticRow()
|
return StaticRow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public var TextField: UITextField {
|
public var TextField: UITextField {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let textField = UITextField()
|
let textField = UITextField()
|
||||||
textField.enablesReturnKeyAutomatically = true
|
textField.enablesReturnKeyAutomatically = true
|
||||||
textField.returnKeyType = .done
|
textField.returnKeyType = .done
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public var TextView: UITextView {
|
public var TextView: UITextView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
return UITextView().font(17)
|
return UITextView().font(17)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public var View: UIView {
|
public var View: UIView {
|
||||||
|
cpk_swizzleMethodsIfNeed()
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
@ -601,28 +601,31 @@ extension NSMutableAttributedString {
|
|||||||
|
|
||||||
fileprivate var __flagForMethodSwizzle__: Bool = false
|
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 {
|
extension UIApplication {
|
||||||
open override var next: UIResponder? {
|
open override var next: UIResponder? {
|
||||||
if !__flagForMethodSwizzle__ {
|
cpk_swizzleMethodsIfNeed()
|
||||||
__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))
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.next
|
return super.next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1901,7 +1904,7 @@ public class StaticRow: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override class var layerClass: Swift.AnyClass {
|
public override class var layerClass: Swift.AnyClass {
|
||||||
return CATransformLayer.self
|
return CPKTransformLayer.self
|
||||||
}
|
}
|
||||||
|
|
||||||
func switchDidChange() {
|
func switchDidChange() {
|
||||||
|
Loading…
Reference in New Issue
Block a user