Skip to content

How to remove the animation #86

Open
@lohenyumnam

Description

@lohenyumnam

I am using this MessageViewController, with IGListKit, and I notice something when the viewController appears there is some kind of animation. is this just me ??

Activity

nathantannar4

nathantannar4 commented on Jan 22, 2019

@nathantannar4
Contributor

Could you describe what animation you are seeing and how it differs from your expectations? Or attach a .gif?

lohenyumnam

lohenyumnam commented on Jan 22, 2019

@lohenyumnam
Author

out

I don't think this is normal

BasThomas

BasThomas commented on Jan 22, 2019

@BasThomas
Collaborator

That indeed does not look normal. Can you post some of your code, and explain when this behavior occurs?

lohenyumnam

lohenyumnam commented on Jan 23, 2019

@lohenyumnam
Author

@BasThomas This animation appears when this particular collectionView or tableview appear, here is the slow motion GIF of it
vv

and the code is nothing fancy. just a normal tableView.

import UIKit
import MessageViewController

class ViewController: MessageViewController {
    let tableView = UITableView()

    override func viewDidLoad() {
        super.viewDidLoad()
        setup(scrollView: tableView)
        // Change the appearance of the text view and its content
        messageView.inset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
        messageView.textView.placeholderText = "New message..."
        messageView.textView.placeholderTextColor = .lightGray
        messageView.font = .systemFont(ofSize: 17)
        messageView.backgroundColor = .yellow
        self.borderColor = .red
        
        // Setup the button using text or an icon
        messageView.setButton(title: "Send", for: .normal, position: .right)
        messageView.rightButtonTint = .blue
        
        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
        tableView.dataSource = self
        
    }
}

extension ViewController: UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
        cell.backgroundColor = .green
        return cell
    }
}
nathantannar4

nathantannar4 commented on Jan 23, 2019

@nathantannar4
Contributor

I believe changing messageView.inset and calling messageView.setButton will trigger a new layout is needed, try calling layoutIfNeeded at the end of viewDidLoad

lohenyumnam

lohenyumnam commented on Jan 23, 2019

@lohenyumnam
Author

@nathantannar4 Not working. I tried calling on

messageView.layoutIfNeeded()
tableView.layoutIfNeeded()
self.view.layoutIfNeeded()

I upload the code example here
https://github.com/lohenyumnam/MessageViewControllerTest

nathantannar4

nathantannar4 commented on Jan 23, 2019

@nathantannar4
Contributor

I think this is only present when you set MessagesViewController as the root of a UIWindow launching. It seems to be animating the layout. When I put super.viewDidLoad() and your setup code in UIView.performWithoutAnimation { } the issue goes away. Or it could be something in MessagesViewController, haven't looked super deep into it

lohenyumnam

lohenyumnam commented on Jan 23, 2019

@lohenyumnam
Author

It's not working for me. @nathantannar4 even with this code

UIView.performWithoutAnimation {
            self.setup(scrollView: tableView)
        }
lohenyumnam

lohenyumnam commented on Jan 23, 2019

@lohenyumnam
Author

@BasThomas @nathantannar4 I think this problem is a bug

nathantannar4

nathantannar4 commented on Jan 24, 2019

@nathantannar4
Contributor

@lohenyumnam If you refer to my last comment I meant ALL setup code in viewDidLoad, not just the scroll view setup.

Im not sure how much of a bug this would be, as its only reproducible during app launch. Do you have a specific use case for why you're using MessagesViewController as your root vc?

lohenyumnam

lohenyumnam commented on Jan 25, 2019

@lohenyumnam
Author

@nathantannar4 I tried putting all the code inside the UIView.performWithoutAnimation , got the same result.
And as for root vc the animation still occurs even if it's not root vc.

msg

lohenyumnam

lohenyumnam commented on Jan 25, 2019

@lohenyumnam
Author

This Unusual animation doesn't seem to occur in the example project, so what I did is I copy the example's ViewController code to my ViewController and here is the result. we can see the same animation.

ee

And I didn't stop, there just to make sure, this time I copy my ViewController's code to example's ViewController and here is the result

example

lohenyumnam

lohenyumnam commented on Jan 25, 2019

@lohenyumnam
Author

Ok here is the thing this problem seems to go away if I install from master

pod 'MessageViewController', :git => 'https://github.com/GitHawkApp/MessageViewController.git', :branch => 'master'

nathantannar4

nathantannar4 commented on Jan 25, 2019

@nathantannar4
Contributor

Possibly fixed in https://github.com/GitHawkApp/MessageViewController/pull/72 then?

lohenyumnam

lohenyumnam commented on Jan 25, 2019

@lohenyumnam
Author

@nathantannar4 I am not sure, but master branch doesn't seems to have the problem.
is there any reason why the default pod version is not pointing to the latest version ?

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @BasThomas@nathantannar4@lohenyumnam

        Issue actions

          How to remove the animation · Issue #86 · GitHawkApp/MessageViewController