     }
 
     func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
-
-        //pullToRefreshView.scrollViewWillEndDragging(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
 
         dragBeginLocation = nil
     }

    }
    */
}

/*
// MARK: PullToRefreshViewDelegate
extension ConversationViewController: PullToRefreshViewDelegate {

    func pulllToRefreshViewDidRefresh(pulllToRefreshView: PullToRefreshView) {

        if displayedMessagesRange.location == 0 {

            if let recipient = conversation.recipient {

                let timeDirection: TimeDirection
                if let maxMessageID = messages.first?.messageID {
                    timeDirection = .Past(maxMessageID: maxMessageID)
                } else {
                    timeDirection = .None
                }

                messagesFromRecipient(recipient, withTimeDirection: timeDirection, failureHandler: nil, completion: { messageIDs in
                    println("messagesFromRecipient: \(messageIDs.count)")

                    delay(0.3) { // 人为延迟，增加等待感
                        pulllToRefreshView.endRefreshingAndDoFurtherAction() {
                            dispatch_async(dispatch_get_main_queue()) {
                                tryPostNewMessagesReceivedNotificationWithMessageIDs(messageIDs, messageAge: timeDirection.messageAge)
                                //self?.fayeRecievedNewMessages(messageIDs, messageAgeRawValue: timeDirection.messageAge.rawValue)
                            }
                        }
                    }
                })
            }

        } else {

            delay(0.5) {

                pulllToRefreshView.endRefreshingAndDoFurtherAction() { [weak self] in

                    if let strongSelf = self {
                        //let lastDisplayedMessagesRange = strongSelf.displayedMessagesRange

                        var newMessagesCount = strongSelf.messagesBunchCount

                        if (strongSelf.displayedMessagesRange.location - newMessagesCount) < 0 {
                            newMessagesCount = strongSelf.displayedMessagesRange.location
                        }

                        if newMessagesCount > 0 {
                            strongSelf.displayedMessagesRange.location -= newMessagesCount
                            strongSelf.displayedMessagesRange.length += newMessagesCount

                            strongSelf.lastTimeMessagesCount = strongSelf.messages.count // 同样需要纪录它

                            var indexPaths = [NSIndexPath]()
                            for i in 0..<newMessagesCount {
                                let indexPath = NSIndexPath(forItem: Int(i), inSection: Section.Message.rawValue)
                                indexPaths.append(indexPath)
                            }

                            let bottomOffset = strongSelf.conversationCollectionView.contentSize.height - strongSelf.conversationCollectionView.contentOffset.y

                            CATransaction.begin()
                            CATransaction.setDisableActions(true)

                            strongSelf.conversationCollectionView.performBatchUpdates({ [weak self] in
                                self?.conversationCollectionView.insertItemsAtIndexPaths(indexPaths)

                            }, completion: { [weak self] finished in
                                if let strongSelf = self {
                                    var contentOffset = strongSelf.conversationCollectionView.contentOffset
                                    contentOffset.y = strongSelf.conversationCollectionView.contentSize.height - bottomOffset

                                    strongSelf.conversationCollectionView.setContentOffset(contentOffset, animated: false)

                                    CATransaction.commit()

                                    // 上面的 CATransaction 保证了 CollectionView 在插入后不闪动
                                    // 此时再做个 scroll 动画比较自然
                                    let indexPath = NSIndexPath(forItem: newMessagesCount - 1, inSection: Section.Message.rawValue)
                                    strongSelf.conversationCollectionView.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.CenteredVertically, animated: true)
                                }
                            })
                        }
                    }
                }
            }
        }
    }

    func scrollView() -> UIScrollView {
        return conversationCollectionView
    }
}
*/

// MARK: AVAudioRecorderDelegate



        return view
    }()

    private lazy var waverView: YepWaverView = {
        let frame = self.view.bounds
