Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
Hiii !
it's my second app on Xcode.
I noticed that my navigation item is not a button but a "drop down" and I don't know why
How can I change it ? Image: navigation item
So from the comment, I will answer detail about your problem for futher reader and yourself.
As Swift there is two types of tranfering to from view controller to another view controller
First one is using presentViewController which is presents a view controller modally. Just like from your image and we usually use it for task you don't want user to navigate from so just two methods cancel or continue. Example: Sign In, Sign Up, ...
Second one is using pushViewController which will have a Back button just like you want in the navigation bar. And in this case you can control your own controller, callback, ... Remember to define what is root view controller by using Embed in Navigation controller if you use storyboard or define by code by using
UIApplication.shared.windows.first?.rootViewController = vc // your view controller
What you're dealing with is that your storyboard or screen is as a sheet.
Segue set as Page Sheet
Changing this to full screen will give it a bar, but you may need to embed the scene into a navigation control to create a bar. You can do that via Editor -> Embed In -> Navigation Controller.
Segue set to full screen
Embedded into Navigation Controller
The navigation controller color is set to black to be noticeable.
Related
I'm new in Swift and iOS dev however I think that I know how to eat it.
I have a problem when trying to use popToViewController. The problem is that I want to "clear" UINavigation stack when pressing the button.
So I did this like here:
navigationController?.popToViewController((navigationController?.viewControllers[0])!, animated: false)
I want to have only first ViewController in the stack.
Before I click on the button stack contains
([<EmpMan.ViewController: 0x7fd191535ba0>,
<EmpMan.TableViewController: 0x7fd191564be0>,
<EmpMan.NewEmployee: 0x7fd1916c0320>])
When I click on the button the stack looks:
([<EmpMan.ViewController: 0x7fd191535ba0>,
<EmpMan.TableViewController: 0x7fd191564be0>,
<EmpMan.NewEmployee: 0x7fd1916c0320>,
<EmpMan.TableViewController: 0x7fd19171dbf0>])
I think after popToViewController the stack should contains only ViewController. Why it does not work?
If what the button does is a segue, than just do the "Show detail segue and you are done.
Otherwise, make a boolean in the viewController with the button that is set to true when you press the button. Create a secondary segue out of each of the possible segue routes out of the controller. Then if that boolean is set to true, use a "Show Detail Segue" as your next segue instead of a "Show Segue".
Show Detail automatically clears the navigation stack. There are other ways of handling this as well, but I am just throwing you an acceptable answer that works. Read more about segues and custom segues and the navigation stack to get a thourough understanding. It is worth your time if you want to get heavy into iPhone App dev.
I'm working on a tabbed application using storyboards in Interface Builder. The Stack Overflow question at TabBar in one view leading to a second view with another set of tabbar seems to answer or at least be relevant to my question, but unfortunately I don't understand the answer entirely.
The first tab in the UITabBarController takes people to the main/home view controller, which displays a short text on the screen. I want to add a function whereby the user taps on the screen and a new tab bar slides in (like in iPhoto when you tap on a photo that's been displayed) with options to send, trash, or edit the text.
I don't need the new tab bar to be translucent like it is in iPhoto.
How do I do this?
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
How do I create a view that stays onscreen while I switch between tabs?
i have a tab bar conttoller, i wanted to create a view(it dispalys balance).
I wanted that view to be displayed on top through out my application.
How can create such a view???
this way, you have to put the tabbar inside a view first (you should start with a plain view project or other project except for tabbar project)
so what u want to do is
start with a plain view project (my choice)
in header, put tabbardelegate
in header, create TabBarController variable (for instead : myTabBar)
populate the myTabBar in the implementation file
add the myTabBar to the view by using [self.view addSubView:myTabBar.view]
after you added the tabbar as a subview, proceed into making your new view (the one with balance)
add the new view as a subview of the main parent view
this way, the balance view will place above the tabbar view, meaning, it will always be displayed above the tabBar
its quite simple, really, if u have rather complex codes, you can always insert the subview by index such as :
[self.view insertSubview:theView atIndex:theIndex]
or
[self.view insertSubview:balanceView aboveSubview:myTabBar.view]
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
View Controllers: How to switch between views programmatically?
i want to go to another view from one view on a button click
please help me........
thank you
Use a UINavigationController to display the first view. When the user taps your button, call the navigation controller's pushViewController:animated: method. To return to the previous view programmatically, call one of the pop...ViewController... methods (though this may not be required, since the navigation controller itself can handle "back" button taps).
If you don't want to use the uiNevigationController then use:
[self.view addSubView:objectOfSecondPage.view];
and add this on the back button in the next page
[removeFrom SuperView];
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to tell when back button is pressed in a UINavigationControllerStack
When I press the back button, what Delegate method is called?
UINavigationBarDelegate is the delegate class and it implements -navigationBar:shouldPopItem, since these controllers work in stacks you're just pushing or popping views. This will most likely always evaluate to true otherwise I feel a back button that does anything but pop a view controller will violate Apple's Human Interface Guidelines.
I agree with elsurudo, the - (void)viewWillDisappear also gets called when you go to a third ViewController, but maybe you want your connection to exist in the Third View Controller but not in the First View Controller. So you might want to detect when the user goes back from the Second View Controller so you can disconnect properly.