update xib view
This commit is contained in:
parent
e9609abaa9
commit
60f2b1cefb
|
|
@ -45,7 +45,8 @@ open class XibView: UIView {
|
|||
}
|
||||
|
||||
private func setupView() {
|
||||
let view: UIView = UIView.loadFromNib(named: innerViewNibName)
|
||||
let bundle = Bundle(for: type(of: self))
|
||||
let view: UIView = UIView.loadFromNib(named: innerViewNibName, bundle: bundle)
|
||||
|
||||
// Make frame size match the size of the content view in the xib
|
||||
frame = CGRect(origin: frame.origin, size: view.frame.size)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ import UIKit
|
|||
|
||||
public extension String {
|
||||
|
||||
/**
|
||||
method returns image with self name
|
||||
|
||||
- returns: image
|
||||
*/
|
||||
public var image: UIImage? {
|
||||
return UIImage(named: self)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,15 @@ import TableKit
|
|||
|
||||
public extension TableDirector {
|
||||
|
||||
/**
|
||||
method replaces current table director's section at index and reloads it
|
||||
|
||||
- parameter section: new section
|
||||
- parameter index: current replaced section index
|
||||
- parameter reload: is reloaded after replace
|
||||
|
||||
- returns: self
|
||||
*/
|
||||
@discardableResult
|
||||
public func replace(section: TableSection, atIndex index: Int, reload: Bool = true) -> Self {
|
||||
if index < sections.count {
|
||||
|
|
@ -36,6 +45,14 @@ public extension TableDirector {
|
|||
return self
|
||||
}
|
||||
|
||||
/**
|
||||
method reloads section at index with animation
|
||||
|
||||
- parameter index: current reloaded section index
|
||||
- parameter animation: reloading animation. Default .none
|
||||
|
||||
- returns: self
|
||||
*/
|
||||
@discardableResult
|
||||
public func reload(sectionAtIndex index: Int, with animation: UITableViewRowAnimation = .none) -> Self {
|
||||
let action = { [tableView] in
|
||||
|
|
@ -53,17 +70,38 @@ public extension TableDirector {
|
|||
return self
|
||||
}
|
||||
|
||||
/**
|
||||
method replaces current table director's state with sections
|
||||
|
||||
- parameter sections: new sections
|
||||
|
||||
- returns: self
|
||||
*/
|
||||
@discardableResult
|
||||
public func replace(withSections sections: [TableSection]) -> Self {
|
||||
clear().append(sections: sections).reload()
|
||||
return self
|
||||
}
|
||||
|
||||
/**
|
||||
method replaces current table director's state with section
|
||||
|
||||
- parameter section: new section
|
||||
|
||||
- returns: self
|
||||
*/
|
||||
@discardableResult
|
||||
public func replace(withSection section: TableSection) -> Self {
|
||||
return replace(withSections: [section])
|
||||
}
|
||||
|
||||
/**
|
||||
method replaces current table director's state with rows
|
||||
|
||||
- parameter rows: new rows
|
||||
|
||||
- returns: self
|
||||
*/
|
||||
@discardableResult
|
||||
public func replace(withRows rows: [Row]) -> Self {
|
||||
return replace(withSection: TableSection(rows: rows))
|
||||
|
|
|
|||
|
|
@ -24,9 +24,18 @@ import UIKit
|
|||
|
||||
public extension UIApplication {
|
||||
|
||||
/// default scale
|
||||
static let snapshotScale: CGFloat = 1.5
|
||||
/// default root controller animation duration
|
||||
static let snapshotAnimationDuration = 0.5
|
||||
|
||||
/**
|
||||
static method changes root controller in window and sets status bar style
|
||||
|
||||
- parameter controller: new root controller
|
||||
- parameter statusBarStyle: new status bar style
|
||||
- parameter appWindow: application window
|
||||
*/
|
||||
public static func changeRootController(controller: UIViewController,
|
||||
statusBarStyle: UIStatusBarStyle,
|
||||
appWindow: UIWindow?) {
|
||||
|
|
@ -42,6 +51,12 @@ public extension UIApplication {
|
|||
UIApplication.shared.statusBarStyle = statusBarStyle
|
||||
}
|
||||
|
||||
/**
|
||||
static method animates changing root controller
|
||||
|
||||
- parameter controller: new root controller
|
||||
- parameter window: current window
|
||||
*/
|
||||
private static func animateRootViewControllerChanging(controller: UIViewController,
|
||||
window: UIWindow) {
|
||||
if let snapshot = window.snapshotView(afterScreenUpdates: true) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue