Comments (4)
umm... I'm not sure why there is a offset on tableView.
Look like you need checkout iOS 11 changed API. Or you need set section height is 0.
from flix.
But... I just write this code on your Example, and the tableView
is your Example's code:
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.white
self.view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor).isActive = true
tableView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
tableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor).isActive = true
tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
tableView.backgroundColor = Specs.color.background
tableView.separatorColor = Specs.color.background
tableView.rowHeight = 44
tableView.sectionFooterHeight = 0.1
tableView.sectionHeaderHeight = 0.1
tableView.estimatedRowHeight = 0
tableView.estimatedSectionFooterHeight = 0
tableView.estimatedSectionHeaderHeight = 0
RxKeyboard.instance.visibleHeight
.drive(onNext: { [unowned self] keyboardVisibleHeight in
self.tableView.contentInset.bottom = keyboardVisibleHeight
self.tableView.scrollIndicatorInsets.bottom = keyboardVisibleHeight
})
.disposed(by: disposeBag)
}
from flix.
If you async set delegate
, you will get 35 point offset.
class ViewController: TableViewController, UITableViewDataSource, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
self.tableView.dataSource = self
DispatchQueue.main.async {
self.tableView.delegate = self
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return CGFloat.leastNonzeroMagnitude
}
}
To fix this, you can try to set delegate
immediately after add UITableView
, or change contentInset
.
If you use Flix, you should build providers in viewDidLoad
。
from flix.
Because providers are depend on the datas from server, I have to build these providers after the datas come.
I solve this problem, thanks for that.
from flix.
Related Issues (20)
- Why my `tap action` is not working? HOT 2
- Doesn't conform to protocol NSObjectProtocol HOT 2
- 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.