为什么我的徽标未显示在侧面菜单中?

时间:2019-06-25 13:20:55

标签: swift

我做了一个汉堡包侧菜单,并想在其中心显示徽标。但是它没有出现。我想念什么? Here是侧面菜单的图片。

enum MenuType: Int, CaseIterable {

case plan, documentation, visitlist, document, constructdiary, plancorrection
case sync, settings, info

var section: Int {
    switch self {
    case .plan, .documentation, .visitlist, .document, . constructdiary, .plancorrection: return 0
    case .sync, .settings, .info: return 1
    }
}

var row: Int? {
    switch self.section {
    case 0: return self.rawValue
    case 1: return self.rawValue - MenuType.allCases.filter{ $0.section < self.section }.count
    default: return nil
    }
}}
class MenuViewController: UITableViewController {

var didTapMenuType: ((MenuType) -> Void)?

@IBOutlet weak var imageView: UIImageView!

override func viewDidLoad() {
    super.viewDidLoad()
   setupNavbarLogo()
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    guard let menuType = MenuType.allCases.first(where: { $0.section == indexPath.section && $0.row == indexPath.row }) else {return}
    dismiss(animated: true) { [weak self] in
        self?.didTapMenuType?(menuType)
    }
}

func setupNavbarLogo() {
    let logo = UIImage(named: "Logo")
    let imageView = UIImageView(image: logo)
    imageView.contentMode = .scaleAspectFit
    self.navigationItem.titleView = imageView

}}

图像应显示在侧面菜单的中央

0 个答案:

没有答案