What method is called when UINavigationController is presented?

harinsa

I am trying to subclass the UINavigationController to add a custom subview underneath its UINavigationBar. The problem is when I set my custom UINavigationController as the rootViewController of my window, the UINavigationBar position changes, so I want to update the position of my custom view accordingly. My question is where should I put my code to update my custom view.

    var navController = TabbedNavigationController(rootViewController: firstView)

    // navController.navigationBar.frame.origin.y = 0
    self.window?.rootViewController = navController
    self.window?.makeKeyAndVisible()
    // navController.navigationBar.frame.origin.y = 20.0
matt

What you are trying to do is respond to the positioning of subviews of the navigation controller's view. Positioning of subviews is called layout, and takes place in layoutSubviews. Thus, you could try implementing viewDidLayoutSubviews, which is called immediately after layoutSubviews. Note that it can be called many times but you may want to add your subview only once, so be careful to add appropriate guards.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

When is toString() method called

분류에서Dev

why is mockito not called when executing mocked method?

분류에서Dev

What happens when QTcpSocket::close() is called?

분류에서Dev

Does new transaction starts when method b() is called from method a()?

분류에서Dev

iOS - UITableView Position Resets When Controller is Presented

분류에서Dev

View presented by UINavigationController embedded in UITabBarController doesn't size view to account for tabBar at bottom of view

분류에서Dev

java ajax method getting confused when called by multiple sources

분류에서Dev

"InvalidOperationException: A method was called at an unexpected time" when calling MediaCapture.StartPreviewAsync

분류에서Dev

What event is called when you close apps on Nexus 7?

분류에서Dev

Calling a Method if another Method is called

분류에서Dev

How can I find out what controller method was called in a Laravel4 NotFoundHttpException?

분류에서Dev

What is this variable type called?

분류에서Dev

What is this thing called?

분류에서Dev

How do I know which method/class is called when I test java GUI in eclipse?

분류에서Dev

How to use a method from the Startup form to enable its controls when called through a child form?

분류에서Dev

Firebase Cloud Functions: What to name parameters when using onCreate() method?

분류에서Dev

What does provider mean when used in method declaration?

분류에서Dev

What is it called when you can log into multiple workstations with one username and password

분류에서Dev

In Java is there a name for the object the method is called on?

분류에서Dev

AbstractTableModel setValueAt method not being called

분류에서Dev

Control method called using variables

분류에서Dev

Should a method called by a constructor be static?

분류에서Dev

Should a method called by a constructor be static?

분류에서Dev

How to stub a method that is called in initialize method

분류에서Dev

EXC_BAD_ACCESS when adding UINavigationController in code

분류에서Dev

Removing Status Bar In IOS 8 When Using A UINavigationController

분류에서Dev

dismissViewController doesn't dismiss presented view controller when using universal storyboard

분류에서Dev

jQuery+Edge Animate: Error only when called from click event: Object [object Object] has no method 'foundation'

분류에서Dev

Keyboard dismissing when setState is called

Related 관련 기사

  1. 1

    When is toString() method called

  2. 2

    why is mockito not called when executing mocked method?

  3. 3

    What happens when QTcpSocket::close() is called?

  4. 4

    Does new transaction starts when method b() is called from method a()?

  5. 5

    iOS - UITableView Position Resets When Controller is Presented

  6. 6

    View presented by UINavigationController embedded in UITabBarController doesn't size view to account for tabBar at bottom of view

  7. 7

    java ajax method getting confused when called by multiple sources

  8. 8

    "InvalidOperationException: A method was called at an unexpected time" when calling MediaCapture.StartPreviewAsync

  9. 9

    What event is called when you close apps on Nexus 7?

  10. 10

    Calling a Method if another Method is called

  11. 11

    How can I find out what controller method was called in a Laravel4 NotFoundHttpException?

  12. 12

    What is this variable type called?

  13. 13

    What is this thing called?

  14. 14

    How do I know which method/class is called when I test java GUI in eclipse?

  15. 15

    How to use a method from the Startup form to enable its controls when called through a child form?

  16. 16

    Firebase Cloud Functions: What to name parameters when using onCreate() method?

  17. 17

    What does provider mean when used in method declaration?

  18. 18

    What is it called when you can log into multiple workstations with one username and password

  19. 19

    In Java is there a name for the object the method is called on?

  20. 20

    AbstractTableModel setValueAt method not being called

  21. 21

    Control method called using variables

  22. 22

    Should a method called by a constructor be static?

  23. 23

    Should a method called by a constructor be static?

  24. 24

    How to stub a method that is called in initialize method

  25. 25

    EXC_BAD_ACCESS when adding UINavigationController in code

  26. 26

    Removing Status Bar In IOS 8 When Using A UINavigationController

  27. 27

    dismissViewController doesn't dismiss presented view controller when using universal storyboard

  28. 28

    jQuery+Edge Animate: Error only when called from click event: Object [object Object] has no method 'foundation'

  29. 29

    Keyboard dismissing when setState is called

뜨겁다태그

보관