-3

I'm working on a simple notes app, and I'm pretty new to programming & xcode in general. I basically have a text field set up as an IBOutlet. When the numbers inside of the text field match the "password", and the button is clicked, I want the app to switch views (into the main application, and when the button is click, but the numbers inside of the text field do not match the password, then a message pops up saying "The password submitted is incorrect".

I have an if statement set up already, which basically says "If the password is correct, do this. If the password is not correct, do this.", but I don't know what to write in the "password is correct" portion. I've tried quite a few things, and I can't find anything that successfully gets the view to change only when the password is correct upon pressing the button. I do not want to use a segue as this makes views change regardless of the password submitted. I just don't know what to put inside of the if statement.

I'll Gyazo links to screenshots of my xcode project.

Thanks for the help!

Screenshots Link:

https://i.stack.imgur.com/OHs3r.png

If I'm missing anything or you need more info, please let me know!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
sethled
  • 3
  • 3
  • Instead of posting a screenshot, update your question with the relevant code. Show what you have tried and explains exactly what you need help with. – rmaddy Jul 11 '14 at 01:38
  • possible duplicate of [IOS7, Segue and storyboards - How to create without a button?](http://stackoverflow.com/questions/21205485/ios7-segue-and-storyboards-how-to-create-without-a-button) – nhgrif Jul 11 '14 at 01:38
  • If you want to include code, include it as plain text rather than as a screen shot. For one, it makes it easier for us to see the code and the question together, and for two, it improves search engine results. – nhgrif Jul 11 '14 at 01:39

1 Answers1

2

You can still use segues. Just don't attached them to the button(s). Create a segue from one view controller to another and give it an identifier. Then, if your password condition is satisfied, you can call:

[self performSegueWithIdentifier:@"YourSegueID" ...]
joelg
  • 1,094
  • 9
  • 19