Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch from one view to another in iPhone?

Tags:

objective-c

I am a beginner in objective-c. Can anyone please tell me how can I switch from one view to another in an iPhone application.

like image 755
Junior Bill gates Avatar asked May 05 '11 12:05

Junior Bill gates


2 Answers

View Programming Guide for iOS

iPhone View Switching Tuturial

How To Switch Views using Multiple Viewcontrollers (Method 1)

Switching Views with Animation

How to animate View swap on simple View iPhone App?

switch between uiviews with buttons and not uinavigation controllers

Switch between UIViewControllers using UISegmentedControl

like image 74
Joe Avatar answered Sep 22 '22 12:09

Joe


There are 3 main controllers that can switch views for you:

  • UINavigationController
    • Here you push and pop views in a chain.
    • There will be a navigation bar on top which lets you navigate back to where you came from.
  • UITabbarController
    • Here all the views will be represented by tabs at the bottom of the screen.
    • You can switch back and forward between them by clicking them in the tabbar.
  • UIViewController
    • There is a method in UIViewController wich lets you "present" other viewcontrollers. It's called presentModalViewController:animated:
    • You will have to do your own navigation back to the parent by using dismissViewControllerAnimated:

You can also do your own switching with variations of addSubView: or view.hidden or similar, but I would recommend those 3 to begin with.

like image 33
vakio Avatar answered Sep 21 '22 12:09

vakio