diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 4e55c714..f53b8a76 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -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) { diff --git a/Yep/Views/ConversationMore/ConversationMoreView.swift b/Yep/Views/ConversationMore/ConversationMoreView.swift index 53ef74dc..43a8e9ae 100644 --- a/Yep/Views/ConversationMore/ConversationMoreView.swift +++ b/Yep/Views/ConversationMore/ConversationMoreView.swift @@ -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