Xcode - How to switch view in storyboard

I am developing my first iPhone application. I'm still not very good at Xcode, and my question is pretty simple. I am using Xcode 5 and I am using storyboards in my project.

Well, I have some images in the View controller. I would just like it if I touch one of these images, I switch to another view controller, nothing else. How can i do this?

I was looking for a solution on the Internet, and I found out on YouTube that I only have to Control-Click my image and connect it to another view using a modal connection without any code. However, I tried in the simulator and it does not work. In addition, most online tutorials are outdated, and they explain how to do this on Xcode 4.2 without using a storyboard.

Can you help me? Thanks.

+4
source share
2 answers

You cannot just use UIImage. You need to use UIButton, and then set the button to custom according to its properties and set the background image to the desired image. Then you can click and drag from the button to a new view and select modal .

I have a choice of modal , because from what I can assemble, you are not using a navigation controller. Therefore, you will want to introduce a view manager.

+1
source

Try the following:

 HomeViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"Home"]; [self presentViewController:vc animated:YES completion:nil]; 

c Home - this is the identifier of the main screen frame

+4
source

Source: https://habr.com/ru/post/1500594/


All Articles