1

When i add with PushViewController the navigation header remains visible with this code:

View viewp = new View();
NavigationController.PushViewController(viewp, false);

but when i add with PresentViewControllerAsync the navigation header is hidden, what is wrong?

viewp.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
this.PresentViewController(viewp, true, null);  

i am using ios13, what is my wrong? the buttons right and left do not show

enter image description here

becauseR
  • 39
  • 7
  • You can share two screenshots to show difference between them , this will be helpful to know whether it's an issue in iOS 13 . – Junior Jiang Nov 11 '19 at 08:41
  • @JuniorJiang-MSFT the buttons right and left do not show – becauseR Nov 11 '19 at 13:35
  • Okey ,thanks for updating question .If the buttons right and left is in Navigation bar , when using `PresentViewController` then it will not show .Have a look at my answer . – Junior Jiang Nov 12 '19 at 01:47
  • If answer be helpful , remember to mark ot vote up later when have time.Thanks in advance *.^ – Junior Jiang Nov 19 '19 at 01:11

1 Answers1

1

There is nothing wrong with them , it's a normal phenomenon .

  • PushViewController need Root View Controller is NavigationController , it only can be used in NavigationController .Therefore , when invoking need as follow :

    NavigationController.PushViewController(xxx)

That also is the reason can see Navigation Bar by this method. Next page is under Navigation Controller . Have a look at UINavigationController and pushViewController:animated: defined :

enter image description here

  • However , PresentViewController can be invoked no matter root view controller wherther be NavigationController or Other controller . It just presents a view controller in the dialog controller’s window. Then there will not show navigation bar in next view , because it's not under the stack of Navigation Controller Stack.

enter image description here

Here are some good discussion about difference between them for reference.

Difference between pushViewController and showViewController

difference between presentViewController and UINavigationController?

Junior Jiang
  • 12,430
  • 1
  • 10
  • 30