Skip to content

About contentOffset of UITableView #113

Closed

Description

@wjling

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.

Activity

  1. lucdion commented on Jan 15, 2018

    @lucdion
    Member

    @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.

  2. lucdion commented on Jan 18, 2018

    @lucdion
    Member

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

  3. wjling commented on Jan 19, 2018

    @wjling
    Author

    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

  4. lucdion commented on Jan 20, 2018

    @lucdion
    Member

    Your issue has been fixed in the 1.5.8 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions