Comments (2)
@VincentSit
create your provider.
for example,
open class MyUniqueCustomTableViewSectionProvider: NSObject, FSPagerViewDataSource, AnimatablePartionSectionTableViewProvider, StringIdentifiableType {
public var identity: String {
return self._flix_identity
}
public static func ==(lhs: UniqueCustomTableViewSectionProvider, rhs: UniqueCustomTableViewSectionProvider) -> Bool {
return true
}
public typealias Cell = UITableViewHeaderFooterView
public typealias Value = UniqueCustomTableViewSectionProvider
open let customIdentity: String
open let tableElementKindSection: UITableElementKindSection
open var isHidden: Bool {
get {
return _isHidden.value
}
set {
_isHidden.value = newValue
}
}
private let _isHidden = Variable(false)
open var sectionHeight: ((UITableView) -> CGFloat)?
open let contentView: UIView = NeverHitSelfView()
open var backgroundView: UIView? {
didSet {
_view?.backgroundView = backgroundView
}
}
private weak var _view: UITableViewHeaderFooterView?
public init(customIdentity: String, tableElementKindSection: UITableElementKindSection) {
self.customIdentity = customIdentity
self.tableElementKindSection = tableElementKindSection
}
public init(tableElementKindSection: UITableElementKindSection) {
self.customIdentity = ""
self.tableElementKindSection = tableElementKindSection
}
open func tableView(_ tableView: UITableView, heightInSection section: Int, value: UniqueCustomTableViewSectionProvider) -> CGFloat? {
return self.sectionHeight?(tableView)
}
open func configureSection(_ tableView: UITableView, view: UITableViewHeaderFooterView, viewInSection section: Int, value: UniqueCustomTableViewSectionProvider) {
if !view.hasConfigured {
_view = view
view.hasConfigured = true
view.backgroundView = self.backgroundView
view.contentView.addSubview(contentView)
contentView.translatesAutoresizingMaskIntoConstraints = false
contentView.topAnchor.constraint(equalTo: view.contentView.topAnchor).isActive = true
contentView.leadingAnchor.constraint(equalTo: view.contentView.leadingAnchor).isActive = true
contentView.trailingAnchor.constraint(equalTo: view.contentView.trailingAnchor).isActive = true
contentView.bottomAnchor.constraint(equalTo: view.contentView.bottomAnchor).isActive = true
}
}
open func genteralSection() -> Observable<UniqueCustomTableViewSectionProvider?> {
return self._isHidden.asObservable()
.map { [weak self] isHidden in
return isHidden ? nil : self
}
}
}
extension Reactive where Base: UniqueCustomTableViewSectionProvider {
public var isHidden: Binder<Bool> {
return Binder(self.base) { provider, hidden in
provider.isHidden = hidden
}
}
}
from flix.
Thanks for your help, my problem has been solved.
BTW, maybe you could consider changing the access level of NeverHitSelfView
to public.
from flix.
Related Issues (20)
- Why my `tap action` is not working? HOT 2
- After network request, tableView build the providers will offset some distance. HOT 4
- Is there a way to use `UniqueCommentTextProvider` in `SettingsViewController` HOT 4
- Align all nodes/CollectionViewCells from bottom ? HOT 2
- Typo in Flix/Flix/Builder/AnimatableCollectionViewBuilder.swift
- How does Flix handle scroll ? HOT 2
- Add in Demo/Guide in main README showcasing how to dynamically add in new CellProvider HOT 4
- Xcode 10 Swift 4.2 build failed HOT 1
- How can I extend SingleUITableViewCellProvider and UICollectionViewDataSource? HOT 2
- I cannot understand why define the type of provider.sectionHeight is ((UITableView) -> CGFloat)?
- 依赖5个其它库 HOT 2
- 请问和 IGListkit 区别是什么 HOT 1
- XCode 10.2 Build Error HOT 1
- RxSwift 5 HOT 2
- SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol UniqueAnimatableCollectionViewProvider - Swift compiler error segmentation fault 11 HOT 11
- Segmentation fault: 11 While emitting IR SIL function ... HOT 1
- Q&A
- pod search flix HOT 3
- Build Failed Task failed with exit code 65: HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flix.