Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About contentOffset of UITableView #113

Closed
wjling opened this issue Jan 15, 2018 · 4 comments
Closed

About contentOffset of UITableView #113

wjling opened this issue Jan 15, 2018 · 4 comments

Comments

@wjling
Copy link

wjling commented Jan 15, 2018

A small problem. I have a let myTableView: UITableView in a UIViewController. I layout the tableView in viewWillLayoutSubviews() with code self.myTableView.pin.top().left().right().bottom().marginTop(self.headBarsHeight + 44).marginBottom(self.bottomBarHeight). The controller is a childController of a tabBarController. I set myTableView.contentInset.top = 15 and reload the tableView after I init the viewController and tableView.contentOffset.y == -15. When I switch tab to the controller and viewWillLayoutSubviews() is called, then I found myTableView.contentOffset.y became 0(I don't want this, I want to keep its offset). If I set myTableView.frame instead of using PinLayout, its contentOffset remains -15.

@lucdion
Copy link
Member

lucdion commented Jan 15, 2018

@wjling, very strange your issue... what happens if in your viewcontroller's viewWillAppear you force a layout (setNeedsLayout(), layoutIfNeeded())?

Also, if you could share me a sample or your app, I could have a look. You can write me directly using my public email if you prefer.

@lucdion
Copy link
Member

lucdion commented Jan 18, 2018

Hi @wjling, we have found your issue, this will be fixed today. Thanks for reporting it!
https://github.com/mirego/PinLayout/pull/115

@wjling
Copy link
Author

wjling commented Jan 19, 2018

Hi @lucdion, I had read about your message and would like to provide a demo. But I forgot it after some busy work. So sorry about that. Glad to hear you have found the issue and help to make PinLayout better

@lucdion
Copy link
Member

lucdion commented Jan 20, 2018

Your issue has been fixed in the 1.5.8 release.

@lucdion lucdion closed this as completed Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants