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

[ASDisplayNode] setNeedsLayout doesn't work only Texture 2.7 #977

Closed
GeekTree0101 opened this issue Jun 19, 2018 · 5 comments
Closed

[ASDisplayNode] setNeedsLayout doesn't work only Texture 2.7 #977

GeekTree0101 opened this issue Jun 19, 2018 · 5 comments

Comments

@GeekTree0101
Copy link
Contributor

similar issue
In my case, I forced setNeedLayout after textNode attributedText value with a few sec delay

     Observable.just(NSAttributedString(string: "test")
            .delay(2.0, scheduler: MainScheduler.asyncInstance) // a few sec delay
            .subscribe(onNext: { [weak self] value in 
                    self?.textNode.attributedText = value // update attributedText (data)
                    self?.setNeedsLayout()  // call setNeedsLayout
             }
            .disposed(by: disposeBag)

Texture 2.6 is correctly work like this picture
v2 6

But, I got unwanted UI in Texture 2.7 like this picture
v2 7

I check frame value from debugger
2018-06-19 6 38 55
I found that UITableViewCellContentView frame isn't equal with ASCellNode frame

So, just update ASCellNode frame with UITableViewCellContentView frame on didEnterVisibleState like this code

    override func didEnterVisibleState() {
        super.didEnterVisibleState()
        self.frame = self.view.superview?.frame ?? self.frame
    }

In this case, it's correctly work like this pic
2018-06-20 12 49 40

@GeekTree0101
Copy link
Contributor Author

2018-06-20 11 20 54

@haashem
Copy link

haashem commented Jun 20, 2018

I have faced such issue when I was changing collection node layout when rotating device. what I did was I write a custom collection flow layout using ASCollectionLayoutDelegate to calculate node frame

@GeekTree0101
Copy link
Contributor Author

When Rx subscribe logic moves from initialization to didLoad method. I no longer faced this problem.
When using RxSwift / RxCocoa, it is safe to subscribe from the didLoad method.

@GeekTree0101
Copy link
Contributor Author

2018-07-27 9 15 04

It is still a problem. I don't know that why constraintedSize min and max are equal & doesn't change after setNeedsLayout.

@GeekTree0101 GeekTree0101 reopened this Jul 27, 2018
@GeekTree0101
Copy link
Contributor Author

close!

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