Giter Site home page Giter Site logo

Comments (3)

atainter avatar atainter commented on June 26, 2024

You'll have to call functions on NMessenger instead of NMessengerViewController for this.

To clear all messages without animation, you can use self.messengerView.clearALLMessages() in NMessengerViewController. Reloading messages is harder since it's not the typical "tableView with data source" model. To reload data you'll have to add all of the messages again. There are a few functions in NMessenger which make it easy to add an array of messages, but you'll have to create those messages first. For example:

/**
     Adds an array of messages to the messenger.
     - parameter messages: An array of messages
     - parameter scrollsToMessage: If marked true, the tableview will scroll to the newly added
     - parameter animation: An animation for newly added messages
     - parameter completion: A completion handler
     */
    public func addMessagesWithBlock(messages: [GeneralMessengerCell], scrollsToMessage: Bool, withAnimation animation: UITableViewRowAnimation, completion: (()->Void)?)

would be called with self.messengerView.addMessagesWithBlock(...).

There aren't any public functions in NMessengerViewController which solely create GeneralMessengerCells for text, image, etc. Would it be helpful to expose those functions?

from nmessenger.

jimmyzzzzzzz avatar jimmyzzzzzzz commented on June 26, 2024

Thanks a lot for the reply. After reading your comment I checked NMessengerViewController.swift source code and found a function called postText() which generates a GeneralMessengerCell. Then I called addMessagesWithBlock() and it's finally working.

from nmessenger.

atainter avatar atainter commented on June 26, 2024

Cool. I think I'm still going to make those functions public.

from nmessenger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.