【发布时间】:2019-02-18 16:21:42
【问题描述】:
我使用the following pod 来实现我的 SideMenu 功能。现在,如果我从 XYZ viewController 打开它并选择再次打开 XYZ viewController 的行,则页面正在被推送,但相反,我希望 SideMenu 被关闭,而不是推送已经呈现的 viewController。
这是用户界面:
这是我的 didSelectRow 代码,非常清楚:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.row {
case 0:
let playerVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "mainPage") as? MainViewController
navigationController?.pushViewController(playerVC!, animated: true)
case 1:
let historyVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "historyPage") as? BroadcastsHistoryViewController
navigationController?.pushViewController(historyVC!, animated: true)
case 2:
let sendMessageVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "messagingPage") as? MessaginViewController
navigationController?.pushViewController(sendMessageVC!, animated: true)
case 3:
let settingsVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "settingPage") as? SettingsViewController
navigationController?.pushViewController(settingsVC!, animated: true)
case 4:
let aboutVC = NavigationHelper.shared.getStoryBoard().instantiateViewController(withIdentifier: "aboutPage") as? AboutAppViewController
navigationController?.pushViewController(aboutVC!, animated: true)
default: break
}
}
到目前为止,我已经尝试检测topMost viewController,获取presentingViewController 属性,但没有成功。谁能帮我以适当的方式处理它?
【问题讨论】:
标签: ios swift viewcontroller side-menu