Please refer the image, where I have used the Navigation BarI tried surfing all over, but could not get the solution. Also, I am new to swift, so kindly help! I have a view controller -- Login page, which is connected to an another view controller-- CoreView.swift. I have created 5 subviews in CoreView ViewController. I want to add a Tab Bar where, user can click on the images of the Tab Bar and the corresponding subview should get open. Also, help me to add the images as the subview icon. the icon does not get displayed.
Also, when I try to put the back button from navigation controller, I can set the Title and prompt message, but not the back button in sub views, why so?
Thanks!
Look at this image to see the code and the xib file made
I have the following changes. but still no luck..
Regarding the navigation bar -> you should be able to just drat and drop the UIButton into your left bar button item:
EDIT: updated image to actually show xib implementation.
EDIT2: to link the button use this:
#IBAction func buttonTapped(sender: AnyObject) {
print("Back button tapped")
}
Make sure to connect the button in your interface builder to your custom view. You need to have a custom UIView subclass and should be chosen for your File's owner.
Related
I have a app that has a tab bar at the bottom.
I am trying to segue to a new view controller via a button that has the code:
#IBAction func moveOver(sender: UIButton) {
self.performSegueWithIdentifier("to-image-select", sender: sender)
}
This works and it segues to the new view, but the tab bar is still at the bottom. How do I make the tab bar not at the bottom? Is there some way of doing a segue that doesnt carry with it the tab bar?
EDIT 1
I do not want the tab bar, I would prefer to have a fully clean UI for this new view. I will have a back button that will take the user back to the previous page in the corner. I am looking into what modally segues are right now.
Will you need your tab bar further in your navigation ?
If yes, you might want to play with the hidden bool property to display it or not.
If no, you could set your segue as presentModally instead of a regular push.
Hope this helps, don't hesitate to provide more information about what your are trying to achieve
You do not have to use tabbar, you can use navigation controller, or present on top. I advise you to try a tutorial about storyboard before jumping in:
https://www.raywenderlich.com/113388/storyboards-tutorial-in-ios-9-part-1
Good luck (:
I have implemented a right item button in the navigation bar. I use the storyboard, no code. But now the back button is not displayed. What's the good way to show it again without boilerplate code ?
Thank you!
You can not see the back button on the rootViewController of the NavigationController
NavigationController automatically add the back button once you push some other ViewController to it.
It will display if you have not hides it explicitly.
If you have drag and drop the BarButtonItem as shown in the attached image, Just run the code and back button will automatically get added if it was not your RootViewController.
If it is RootViewController as displayed in images, try to push some ViewController on it, you will get the back button added.
If you add the left bar button item from Interface Builder, you will not get the back button displayed. Then you have to do it manually
I would like to know how I can add a back button to my UINavigationBar, I know that If I embed in a Navigation Controller in my main view, that all of this would happen automatically, but that is not what I am trying to do, in fact, the back button could go to any other view I connect the segue to, doesn't even have to be the back.
The back button needs to be the system navigation "back" button, I don't want to have to set image files for my buttons.
I tried dragging in a bar button item in storyboard but nothing shows up, doesn't seem to be doing the trick. The navigation bar was dragged to the view in storyboard (not created programmatically) and it shows up just fine.
I looked at the following similarly asked questions:
-> How do i add a 'back' button to a UINavigationBar manually?
-> How to add a button to UINavigationBar?
-> How to programmatically add a UINavigationBar and a back button on it
but they all point to just embedding the view in a navigation controller, which again, is not what I am trying to do.
If someone can please help me out, provide some sample code I would greatly appreciate it.
Try drag-drop a UIButton object. I have always added manual back button (hardly took the in-built one)
I'm making an app with multiple views, using a Navigation Controller. I can easily change views by ctrl-dragging from a button to another view, but it doesn't work by doing the same thing, but with a button in the Navigation Bar.
At first, I had a warning about the style of the button, so I changed it from Plain to Bordered. I have no warning now, but when I click on the button, nothing happens.
Thanks for your help!
Try it again but using a UIBarButton, then link the push action to it and it should work.
Right-click the button and drag the circle next to "Push" under Storyboard Segues over to the view you want the button to navigation to.
I have an existing ios5/xcode 4.2 app, and I want a button to open a view that will display a list of items, and have a back button and an add new button.
I thought I could achieve this by adding a button to the main view controller, then dragging in to the storyboard a new UITableViewController, then embed a UINavigationController (editor->Embed In->Navigation Controller).
Then i right clicked on the button, dragged it to the navigation controller, and thought, ok this should work.
However, there is no back button, and xcode will not let me drag one in, nor will it allow me to drag in the button bar item "[+]" for the link to add new.
When I run the app, the list shows, of course I have no way to go back to the view controller with the button on it.
What am i doing wrong? - thanks.
(my question is similar to this
but for xcode 4.2)
Embed the main view controller, not the new one, in a UINavigationController. This should add a simulated UINavigationBar to the main view (if not, set one up under Simulated Metrics). At this point you should be able to drop in a UIBarButtonItem to the main view's simulated bar.
Next, draw a connection from your button to the new UITableViewController to set up a push segue. At runtime, the back button will appear in the bar automatically.
Make sure when you try and drag the items into your view controller that the storyboard is zoomed in. XCode won't let you add items if you are zoomed out.