Skip to content

Customized comment view, one can be used to manage add comments UI. Easy to apply in existing code with just initialization var and add it as subview.

Notifications You must be signed in to change notification settings

hardikdarji/CustomCommentView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

CustomCommentView

Description:

Customized comment view, one can be used to manage add comments UI. Easy to apply in existing code with just initialization var and add it as subview.

Sample:

simulator screen shot - iphone 8 - 2018-04-05 at 17 08 19

Demo:

img_1374

Requirements:

  • Swift 4.0
  • XCode 9.0
  • iOS 10.0 (Min SDK)

Usage:

    class ViewController: UIViewController 
    {
        //DECLARATION
        var viewCommentView: CommentView = CommentView()

        override func viewDidLoad() {
            super.viewDidLoad()
            // ADD AS SUBVIEW, INIT SETUP AND LET DELEGATE OF COMMENTVIEW TO SELF
            self.view.addSubview(self.viewCommentView)
            self.viewCommentView.initCommentSetup(parentView: self.view)
            self.viewCommentView.delegate = self

        }
        // BUTTON TOUCH EVENT WHERE TO START COMMENT VIEW... WILL APPEAR WITH KEYBOARD AND COMMENT VIEW ABOEVE KEYBOARD...
        @objc func buttonCommentsTouched(sender:UIButton)
        {
            self.viewCommentView.startCommentView(tableView: self.tableViewComment!, sender: sender)
        }
    }

    // DELEGATE METHOD TO HANDLE SEND COMMENT AND DESELECT TABLEVIEW CELL...
    ViewController: handleCommentHeightDelegate{
    func commentSendCompletionHandler(isSuccess: Bool, indexPath: IndexPath?, commentText: String?) {
        if isSuccess
        {
            print("Success: ...)")
            // ADD COMMENT TO ARRAY...
            self.arrComment[(indexPath?.row)!].commentCount += 1
        }
        // DESELEC AND RELOAD ROW
        self.tableViewComment?.deselectRow(at: indexPath!, animated: true)
        self.tableViewComment?.reloadRows(at: [indexPath!], with: .automatic)
        self.view.layoutIfNeeded()
    }
}

Author

hardikdarji: [email protected]

License

CustomCommentView is available under the MIT license. See the LICENSE file for more info.

About

Customized comment view, one can be used to manage add comments UI. Easy to apply in existing code with just initialization var and add it as subview.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages