2

can anyone explain what the difference is between PushViewController and presentModalViewController?

jaydev
  • 47
  • 8

3 Answers3

3

One major difference is that

pushViewController only works in navigation controllers

presentModalViewController works for all view controllers

visakh7
  • 26,380
  • 8
  • 55
  • 69
2

A modal view is made so that it prevents you from doing anything except whatever it is that it wants you to do. You must do something specific to exit the modal state. The modal view also covers up the navigation bar.

When you use PushViewController, it's more flexible through the navigation bar. It doesn't require an extra action to exit to another view.

Joetjah
  • 6,292
  • 8
  • 55
  • 90
0

Difference in animation are

pushViewController will slide in your new view from right.

presentModalViewController will pop up your new view.

visakh7
  • 26,380
  • 8
  • 55
  • 69
Adarsh V C
  • 2,314
  • 1
  • 20
  • 37