show ConversationMoreView in window; hide ConversationMoreView when showProfileAction

This commit is contained in:
nixzhu
2015-06-29 21:12:19 +08:00
parent 56e6ac0a9c
commit 57feaaae53
2 changed files with 27 additions and 3 deletions
@@ -986,7 +986,9 @@ class ConversationViewController: BaseViewController {
self.report()
}
moreView.showInView(view)
if let window = view.window {
moreView.showInView(window)
}
}
func updateNotificationEnabled(enabled: Bool, forUserWithUserID userID: String) {
@@ -185,6 +185,8 @@ class ConversationMoreView: UIView {
layoutIfNeeded()
containerView.alpha = 1
UIView.animateWithDuration(0.05, delay: 0.0, options: .CurveEaseInOut, animations: { _ in
self.containerView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.3)
@@ -200,7 +202,6 @@ class ConversationMoreView: UIView {
}
func hide() {
UIView.animateWithDuration(0.2, delay: 0.0, options: .CurveEaseInOut, animations: { _ in
self.tableViewBottomConstraint?.constant = 300
@@ -217,6 +218,24 @@ class ConversationMoreView: UIView {
})
}
func hideAndDo(afterHideAction: (() -> Void)?) {
UIView.animateWithDuration(0.2, delay: 0.0, options: .CurveLinear, animations: { _ in
self.containerView.alpha = 0
self.tableViewBottomConstraint?.constant = 300
self.layoutIfNeeded()
}, completion: { finished in
self.removeFromSuperview()
})
delay(0.1) {
afterHideAction?()
}
}
var isFirstTimeBeenAddAsSubview = true
override func didMoveToSuperview() {
@@ -382,10 +401,13 @@ extension ConversationMoreView: UITableViewDataSource, UITableViewDelegate {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
if let row = Row(rawValue: indexPath.row) {
switch row {
case .ShowProfile:
showProfileAction?()
hideAndDo { [unowned self] in
self.showProfileAction?()
}
case .DoNotDisturb:
break