D
D
deleted-mezhevikin2015-12-13 16:11:37
Cocoa Touch
deleted-mezhevikin, 2015-12-13 16:11:37

How to indent top in UINavigationController with custom TabBar?

There is a NavigationController class: UINavigationController. Instead of the standard UINavigationBar, I place my view with a height of 75. How can I make the necessary indent from above in topViewController? Tried doing it in the willShowViewController delegate method - the position doesn't change at all.

//
//  NavigationController.swift
//

import UIKit

class NavigationController: UINavigationController, UINavigationControllerDelegate {

    override init(rootViewController: UIViewController) {
        super.init(rootViewController: rootViewController)
        navigationBarHidden = true
        interactivePopGestureRecognizer?.delegate = nil
        self.delegate = self
        addNavigationView()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    func addNavigationView() {
        let navigationView = UIView(x: 0, y: 0, w: view.w, h: 75)
        navigationView.backgroundColor = UIColor.blueColor()
        view.addSubview(navigationView)
    }

    // MARK: Delegate 

    func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
        viewController.view.y = 75;
    }

    func navigationController(navigationController: UINavigationController, didShowViewController viewController: UIViewController, animated: Bool) {

    }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
German Polyansky, 2015-12-15
@f0r3s1

What's the indent? From what? From the top? What view do you need to move? I did not understand anything in the question, what is this code? Take it to didload and move what you need, you started to get smart here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question