I've been trying to outline the basic functionality of a swift application I was developing. I created a basic gui with the storyboard functionality that xcode provides. Here is a picture of what it looks like currently:
What I want to do next is code up a way to receive and store input from the text fields I outlined in the storyboard. Additionally I want to receive information regarding certain settings that are placed from the switches I outlined in the second screen.
I've been looking through the files that xcode provides me but I haven't been able to find the one that contains the functionality for the storyboards. If someone could point me in the right direction for that i would greatly appreciate it. Ultimately I just want to be able to manage the input provided by the interface I outlined below. Thanks!
For each view controller on the storyboard make a subclasses of UIViewController.
In the inspector panel on the left of the storyboard set the class of each view controller to their respective subclass of UIViewController.
Open up the .swift file for that view controller and storyboard and ctrl + drag from the textField to the class this will cause a small popup where you can create an IBOutlet or IBAction.
Related
So I am pretty new to Xcode (but not programming in general, have learned a bit of python and java) and I am trying to figure out, for the life of me, how I connect bits of code in other views besides the first one when they are linked from a navigation controller.
To paint a picture of this, I essentially start out with a single view application, I have the first view and I add a button to it and then I embed it in a navigation controller by doing.. Editor -> Embed In -> Navigation Controller. The next time, as I have been following from various guides online, is that I control drag that button to that view and hit "show" to link them. Now say I have another button in that new view I just linked to. Xcode doesn't seem to let me just control drag that button onto the text in viewcontroller.swift, I believe that this is because they are two separate view controllers now however I have not a clue where the second viewcontroller2.swift file may be. Or, maybe, there is an easier way to link the two views together and actually be able to modify the source files?
If you're trying to find a "ViewController2" you won't find it, because you have to create it! Use Command-N to create a new file and choose "Cocoa Touch Class". Name it something like SecondViewController and make sure it's a subclass of UIViewController. Now you can go back to interface builder and change the class of the second view controller to whatever name you just chose, like SecondViewController.
To address the other part of your question (I think), I'm not exactly sure what you're trying to do. If you want some of your data to transfer to the new ViewController, use the prepareForSegue function in the first ViewController.
My app has multiple screens all of which are different and not related however i must have a burger button which opens the same drop down menu on each screen.
Is it possible in iOS to create the menu once as a view and reuse it on each screen or do I have to create it on each ViewController and implement it.
Any explanation as to how to achieve this would be great.
The best thing would be to implement a custom view or custom control which you reuse in every Controller you want. The good thing is with the new storyboard and a xib file you can even see it in realtime in the storyboard (#ibdesignable).
Check out this: Creating a Custom View That Renders in Interface Builder (Apple Documentation)
Or a great tutorial: Custom UI components
I built my app as a single view application and then later added another view with an .xib. I get how to do that. But what I need to do now is add another view, but this is a UITableViewController that uses storyboards. I am adding IAP from a tutorial I used that uses a MasterViewController and automatically loads the first view, but I didn't make my app that way.
If anyone can explain how I can make it so when you click a button (IBAction) on my original view, I can transition to the UITableViewController that use storyboards that has the table for my IAP, that would be awesome. Is this even possible? If there's another way I'm cool with that too! BTW I am very new to this so please explain in simple terms if possible. So if anyone ca help it would be greatly appreciated.
Put a button on the first form, hold down CTRL and drag the mouse and point to the other form and it will create a segue. You can set the type (push, modal, etc.)
Watch the WWDC session from 2011 introducing Storyboards. Worthwhile.
I've reviewed many websites and youtube videos that have IOS 5 storyboarding information. Most of them are pretty basic and only describe how to get started with storyboarding and how to segue into other views. I'm interested in taking it a step further and actually adding custom code to the views contained within the storyboard.
Is the "normal" workflow when creating an IOS app using storyboard?
Create the layout of an app using storyboard (adding views and objects to those views).
Create viewcontroller files (.h and .m), one for each view contained within the storyboard.
Hook up the scenes from the storyboard with your own view controller subclasses by editing the "class" values in Identity Inspector.
I believe I followed those steps, but when I implemented step #3 above and ran my application, I was only able to see a black screen. The view I had created in storyboard wouldn't display.
You have the right steps. Make sure you create your .m and .h without a xib. Post your code for the view controller for your first view to get more help.
yes, this is the normal workflow. have you set the "initial viewcontroller? ?
see this image: http://dl.dropbox.com/u/31437518/Screen%20Shot%202012-01-24%20at%2012.29.34%20AM.png
It sounds like you made a storyboard file but it isn't being loaded.
Do you have the main storyboard setting in the target summary screen filled in?
I am new to programming in ios and I am trying to do something that I would think would be pretty simple but is turning out to be quite a stuggle. What I have done is created a window based app. Then I added a UIViewController subclass and checked "with xib for user interface". Then in my main application delegate I added an IBOutlet to the UIViewController subclass created and made it show when the application runs. Then in my mainwindow.xib file I linked the application delegate to the IBOutlet that I created. Now when I put a label on that view and run it, it works fine and shows my label. However, I am really unsure of how to make it display the tab bar control. I added the tab bar control but am unsure what to do after that. I have tried many things but nothing worked. If someone has any information on how to do this or something I am probably missing let me know.
Note: I have gotten the tab bar control to work in a window based app by adding the tab bar control and then in the application delegate adding the iboutlet and linking them in interface builder. However, i am unsure how to do it when using a different class to do so.
Any help is appreciated.