I created a Xcode project using the tabbed application template. Currently, when the app is started, it immediately switches to the First View Controller. I would like to change it to go to the Second View Controller instead. I've looked at the Tab Bar Controller for attributes. The only thing I see is under the Connections inspector/Trigger Segues/view controllers shows a list of View Controllers (First, Second, Third). Does anyone know how to change the automatic switch? iOS 8/Xcode 6.1
There are two ways to do this.
Firstly, there's an arrow at the left of the Initial View Controller. You can drag this arrow to any other view controller and that will become the initial controller.
Secondly, you can click on the view controller, go to the Metrics tab in the inspector (the one with the downward pointing thing) and then check the option that says "Is Initial View Controller".
The answer to this question is: Delete the First connection listed under the identity inspector and then re-add it. This bumps the second one up to the first place and positions it where I want it.
Related
I am new to IOS App development and have a question. I'm trying to segue from one view controller to another. However, it seems that every time I ctrl+drag from the options button to the adjacent view controller and choose the 'show' option, the view controller "shifts" down(bottom picture). Why does that happen and if it is not the correct behavior, how can I do it right? Thanks!
You need to set fullscreen style manually if select model style,
a fullscreen option did not show in Push type, you must use Navigation Controller if you want to set fullscreen for Push
https://i.stack.imgur.com/rg20Y.png
When you click on the segue(the line that connects view controllers) and open the Attribute Inspector in right panel, you will see the Kind is set to Present Modally. This means your view controller will popup on your current screen.
You can change the Kind to Push and it will start showing normally.
Also embed your controller in a navigation Controller
Option 2
If you dont want a navigation controller, you can also change the presentation to full screen.
If you're new to iOS
then I might suggest don't use show and don't use segue from storyboard
If you don't know the concept of navigation controller (push and pop methods), then have a look at it (You may not use show afterwards)
have a look at following link
Swift programmatically navigate to another view controller/scene
I am trying to set up a very basic Split View Controller. The left side (master) is a table view, which when a row is tapped, I expect to load details into the right side (detail).
I do not know what I'm doing wrong. I have an example project that functions exactly how I want it to, but I'm missing something in my main project. I've very carefully scoured the example project and as far as I can tell, everything is done exactly the same in my main project.
The problem I'm having is, when I tap a cell in my table view, the view controller that is invoked, appears in the master (left side), not in the detail (right side).
My question is: what exactly do I have to do to get the right side to display the detail?
I'm testing on an iPhone 7 Plus Simulator in landscape mode. Portrait mode works fine.
As far as I know I have all the correct delegate setup complete. Thanks in advance!
Wow! Okay, I figured out what was wrong. This has got to be a bug in the storyboard UI, because it does not make sense that this would be the problem.
When I ctrl-dragged from the table view cell to the nav controller so as to create the detail segue, I chose "show". I then realized that it should actually be "show detail", so I went into the attributes of the segue that I just created and changed "Kind" to "Show Detail (e.g. Replace)", which as far as I know, should end up being the same thing as if I would have selected "Show Detail" when creating the segue. It is not.
After a great deal of trial-and-error, I discovered that I had to delete the segue I originally created and re-create the segue, selecting "Show Detail".
I'm mainly from a C# background, so the workflow for iOS is a bit unusual for me, at least for now.
I was having a problem having simple segue from a main menu, to a another menu/work area, and then with the ability to go back to the main menu.
For a test, apparently I did something wrong.
I didn't write any code for this test to exhibit the problem.
What I did was just,
create a new single-view app
drag an additional view controller onto the work area
drag the start arrow to the new view controller (so it becomes the initial view, same thing as checking the checkbox to set it as the initial view)
added a button to each view controller
Ctrl + clicked and dragged the buttons to the opposing view
for the segue type, I chose "replace"
now the program crashes if I hit the second button to go back to the "main menu" (green view controller in this example)
So what am I doing wrong? Do I need to add some form of delegate or something?
I did find this, though it present fewer segue options in the tutorial than what I have.
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html
These are the options I have when I Ctrl + Click from a button to another view
-Push
-Modal
-PopOver
-Custom
-Replace
"Have you embedded a navigation controller? You need to go to editor->embed in-> Navigation Controller. You need a navigation controller for push segue. – Kaushal Bisht"
This solved it for me. Now I'm just going to work on replacing the navigation bar with custom UI controls.
Thanks everyone! :)
I have an application which has 5 tabs. I also have another view which you can access from tab3 via a selection of buttons. I will call it view 3b. View 3b populates with information based on which button the user selected in view 3. After the user puts in all the information required the app automatically takes them back to view 3. I want to add the tab bar to this view(3b) but I do not want it to have its own tab. I just want to use it so the user can navigate out of this view back to the rest of the app if they want to exit the screen early. Does anyone know how I can attach the tab bar to this screen without having a tab added for this screen. I am using Xcode 4.6.2 and am using storyboards to set up my app.
Any help would be appreciated. I've done a bit of searching but everything I find just explains how to use tabs.
Any help would be appreciated. Thanks.
It sounds like you need to use a UINavigationController.
When you set up your UITabBarController, instead of linking the third tab directly to your 3rd view controller, connect it to a UINavigationController, and then set the root view of that UINavigationController as the UIViewController you want as your third tab.
From there, you can set up your buttons to perform a push segue to your second view controller (view 3b from your question). If you do this, not only will you keep the tab bar on view 3b, but a back button will automatically be placed in the top left of the page so the user can simply go back to view 3. If you don't want the navigation bar that appears to be there, you can instead uncheck the "shows navigation bar" checkbox in the UINavigationController's attributes inspector.
I hope this helps!
Ok. So I have been testing out a simple application on xcode to become familiar with the platform, but I've come across an interesting situation. Using storyboard, I've dragged two view controllers that are connected by buttons by segues. They both have a uitextfield dragged on them that respond on click when they are the initial view. However, when I move to another viewcontroller from the buttoned segue, the keyboards no longer automatically popup. Is this a problem with apple's uitextfield? (ps. there is no code to this as I thought this would simply be automatic responding)
Look to see if the view hierarchy has become messed up. You can easily see this in the 'document outline.'
If you don't see this pane, look on the left, bottom side of the storyboard and click the small arrow pointing to the left.
What do you see here? Is the Text Field an immediate child of the View or of something else? If it's an immediate child, do you see other children of View listed here that you don't recognize?