-2

this is my first time in stackoverflow and I'm pretty new to this Objective C language. What would be the best solution in order to load the page in one View Controller?

References are welcome and I really new great coder's help :(

some say when using IBAction, load a NewViewControllers, but some say put modal View on there. However, there should be going back button, so I can't use a modal view

in one single viewController there should be a new view coming out when pressing the button

this is main page when i press the button it moves to image 1

3 Answers3

0

It looks like that the second view is being presented over the first view. What you can do is present second view on you IBAction as

self.presentViewController(secondViewController, animated: false, completion: nil)

That cross button in second view should then dismiss view through its IBAction as

dismissViewControllerAnimated(false, completion: nil)
mshrestha
  • 788
  • 5
  • 14
0

If you'd like a back button, Your root view controller should be embedded in a UINavigationController. You can initiate a segue programmatically using the performSegueWithIdentifier:sender: method of UIViewController.

Please refer to this link :- Creating a segue programmatically

Community
  • 1
  • 1
shivamkaushik
  • 374
  • 1
  • 12
  • thank you for comment, well my question was pretty dumb...what i was trying to do was loading a new view over main view! once again thank you for your precious comment – Sangwook Park Jul 07 '16 at 05:15
0

As suggested by BalaChandra, you could create a UIView, add a button to it and when you tap that it removes the remove. You could also load your UIView from a xib if that's easier to design, the following gives some examples how to do that, http://eppz.eu/blog/uiview-from-xib/.

If you are happy to use a navigation controller, then what they others have suggested will work,

1) Add a navigational controller to your storyboard, delete the UITableView it gives you by default with it.

2) Add two UIViewControllers, right-click and drag from the navigational to first UIViewController and set it was the rootViewController.

3) Then add a button to the first UIViewController and right-click drag to the second UIViewController and add a show segue.

A back button will automatically be added to the navigation bar when the UIViewController is pushed. The only problem with this approach is that if you want to have controls on the first VC and on the second VC, those will have to be duplicated.

Comment if you would like me to clarify or give some code examples, good luck.

iGatiTech
  • 2,306
  • 1
  • 21
  • 45
JingJingTao
  • 1,760
  • 17
  • 28