Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

[ASButtonNode] Title is truncated in ASButtonNode #1865

Closed
suomalainen9890 opened this issue Jul 8, 2016 · 8 comments · Fixed by #1902
Closed

[ASButtonNode] Title is truncated in ASButtonNode #1865

suomalainen9890 opened this issue Jul 8, 2016 · 8 comments · Fixed by #1902
Milestone

Comments

@suomalainen9890
Copy link

I have a ASButtonNode which has static width and height. Originally the button node has a title, if later title of the button node changes to longer text, new title is truncated even though it takes not even half of the width of the button.

@appleguy
Copy link
Contributor

appleguy commented Jul 8, 2016

@suomalainen9890 thanks for reporting this! It should be fixed by this PR: #1863

Could you test it out locally? If you're able to provide a test project, we can verify it for you. The PR mentioned should land in the next day, and will be in the next release. cc @maicki

@suomalainen9890
Copy link
Author

@appleguy : Thanks! Does it mean that I need to use this in the Podfile?
pod 'AsyncDisplayKit', :git => 'https://github.com/facebook/AsyncDisplayKit.git', :commit => '9d1e669'

I have never tried to do similar thing before.

@maicki
Copy link
Contributor

maicki commented Jul 8, 2016

@suomalainen9890 Can you please try to use this in your Podfile:

pod 'AsyncDisplayKit', :git => 'https://github.com/maicki/AsyncDisplayKit.git', :branch => 'MSFixTextNodeTruncation'

@suomalainen9890
Copy link
Author

@maicki : thanks! I will try.

@suomalainen9890
Copy link
Author

@maicki @appleguy : This is sample project, less than 100 lines of code. I could be doing something wrong here. Please take a look: https://github.com/tungvoduc/ADKBugTest

@maicki maicki changed the title Title is truncated in ASButtonNode [ASButtonNode] Title is truncated in ASButtonNode Jul 11, 2016
@maicki
Copy link
Contributor

maicki commented Jul 12, 2016

@suomalainen9890 Can you try out your example / main project with that fix: #1902 please. Thanks!

Furthermore in your example you have to move some code in the ViewController.swift otherwise the layout does fundamentally not really work:

class ViewController: ASViewController {
    private let _scrollNode: ASScrollNode = ASScrollNode()
    private let _profileInfoNode = ProfileInfoNode()

    override func viewDidLoad() {
        super.viewDidLoad()

        self.node.addSubnode(_profileInfoNode)
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        let size = _profileInfoNode.measureWithSizeRange(ASSizeRange(min: CGSize(width: node.bounds.size.width, height: 0), max: CGSize(width: node.bounds.size.width, height: 100))).size
        _profileInfoNode.frame = CGRect(origin: CGPointMake(0, 20), size: size)
    }

    init() {
        super.init(node: _scrollNode)
        self.edgesForExtendedLayout = UIRectEdge.Bottom
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

@maicki
Copy link
Contributor

maicki commented Jul 14, 2016

Just want to follow up on this issue. I just looked into that again and the initial issue is fixed as the right behavior (relayout of the nodes are bubbling up) will occur if you tap the button.

That said the ASTextNode has currently a problem to provide the right size in certain circumstances after the attributed string changes. This is the same issue we have in #1841. If #1841 will be fixed this issue should be fixed fully too. I will let it closed and further investigation will be in #1841

@suomalainen9890
Copy link
Author

I don't know why button title still not working for me even in version 1.9.90. Title is still truncated when changing title with longer one, and title is not aligned correctly when changing title with shorter one. But it is working in sample project and the code are pretty much the same.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants