I'm developing my first iPhone app. I'm still not very good at Xcode and my question is pretty simple. I'm using Xcode 5 and I'm using storyboards in my project.
Well, I have some images in a View Controller. I'd just like that if I tap one of those images I switch to another View Controller, nothing else. How do I exactly do that?
I looked for a solution online and I found out on YouTube that I have just 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 doesn't work. Also, most of tutorials online are outdated and they explain how to do it on Xcode 4.2 and without using storyboards.
Can you help me please? Thank you.
Try this:
HomeViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"Home"];
[self presentViewController:vc animated:YES completion:nil];
with Home is Storyboard ID of Home Screen
You can't just use a UIImage. You need to use a UIButton and then under the properties set the button to custom and set background image to the image you want. Then you can click and drag from the button to the new view and choose modal
.
I'm having you choose modal
because from what I can gather, you aren't using a navigation controller. Therefore you'd modally want to present the view controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With