Navigation bar back button invisible - ios

There seems to be multiple questions relating to this problem, yet none of them can provide a proper working answer.
I'm using a Navigation Controller in my storyboard to provide navigation to a settings view with a couple of subviews. Table View contains a table with multiple entries, one for each subview. They all have a segue attached to them with identifiers such as SettingsViewToNotificationsSettingsView.
Navigation Controller
-- Relationship to -- >
Table View
-- Perform manual segue -->
Settings subview 1
Settings subview 2
Settings subview 3
Settings subview 4
When selecting an element in the list, the following line of code would be called:
performSegueWithIdentifier("SettingsViewToNotificationsSettingsView", sender: self)
The transition works fine, and the back button does actually transition back to the overview, but it's not visible. I am quite sure, it's not because of the title of the parent view, as it has a title set.
It's even long enough to move the label of each subview off the center to the right, to fit in there. If I programmatically change the title to something shorter (such as ABC), the subview's title is centered again.
Please tell me if any other information is required. Thanks in advance!

Related

how to manage view controllers in a sequential pattern - swift

I'm trying to implement sth like images below. there are some views that should be displayed in a sequential order and a bar above them shows the flow of tasks.
as it is shown, first profile view should be displayed. when the user clicks on Go to Next View Button second view (price view) should be displayed. the top bar shows the current view where we are in it. I've tried PagingMenuController already to create a menu with views and then disable scrolling. but PagingMenuController loads all views at the same time and also i don't know how to go to next menu item within child views. now I'm thinking of a container view might be helpful but i didn't use container view so far and i don't know it's good for my purpose or not.
also i want that top bar without swiping between views (only on buttons) and one enable view at the same time.
any helps would be apprectiated.
Your question is both broad and vague. My answer is also going to be fairly high level. I suggest you follow my outline, and if you get stuck on a particular step, post your code, tell us about the problem you're having, and we can help you fix it.
This is pretty simple. Create custom view controller. Give it a container view at the bottom that would contain the current child view controller. Use view controller transition methods to switch between child view controllers. You'll want to add layout anchors to each new child view controllers to pin all of it's view's edges to the edges of the container view.
Create a custom control on top to show the dot and highlight the title of the current view controller.
If you want the next/previous buttons to be on the child view controllers, put them there, and add a delegate property to all the child view controllers that points to the parent view controller, with next and previous methods.
BTW, in languages, like English, where text is laid out from left to right, I would think your first page would be on the left and the last page would be on the right. (I think it makes more sense for profile to be on the left and pay on the right.)

Setting up iOS Navigation Elements

I am having difficulty figuring out how to set up my UINavigationController to get the result I want. Most succinctly, I want to mimic the navigation of the app BriefMe.
Specifically, I want:
a main view (v#1) that segues to a new view controller (v#2) with an embedded UIWebView
to permanently hide/disable the navigation bar and toolbar on v#1, but I do want a toolbar on v#2 (ideally which shows/hides on swipe -- I figure this can be solved with a UIGestureRecognizer if not through the NavController's hide on swipe/tap property)
v#2 to segue back to v#1 on a swipe from the left edge of the screen, just like the default NavController behavior, shown here.
I've run into two problems with my attempt to set this up:
I can't permanently hide the navigation/toolbar on v#1 while leaving v#1+#2 embedded in a NavController. Without the NavController, I don't retain the swipe-to-segue functionality when v#2 is at the top of the stack
Allowing the WebView to scroll disables/'intercepts' the swipe-to-segue functionality. My only thought is to disable interaction with the WebView, place the WebView in a ScrollView, and allow only vertical scrolling on the ScrollView. Will this allow the swipe-to-segue to work?
If I understand your questions correctly:
We’re still popping a controller from the stack during the transition. We just add the navigation bar as a subview of the controller’s view at the top of the stack and then set up the back event manually.
We ended up using a version of the answer specified here. We added an extra invisible thin column overlaying the left side of the webview because some webviews were still giving us trouble.
Hope that helps!

Xcode 6 - Swift - Custom Tabbar with Navigation

I'm trying to create a tabbed application with navigation elements inside the tab bar, as seen in the picture below (the red bar) using Swift/XCode 6.2. Basically those three icons in the middle will direct the user to different view controllers. The other two icons would be context-based. For example, on a table view page you would see the menu icon and add new icon as seen in the image. However, clicking on a row would change the menu icon to a back icon, and the add icon to something else.
That's the general idea, but I'm having a very hard time implementing something even close to this. The first issue is that whenever I embed a view in a Tab Bar Controller, I can't move the tab bar to the top. However, when I create a custom UITabView in a View Controller, Control + Click and dragging a Tab Bar Item to another view doesn't create a segue. I haven't even begun to tackle having the navigation elements inside the bar.
I guess what I'm asking is just for a little guidance on what route to take to tackle this. I'm assuming I can't use a Tab Bar Controller or Navigation Controller because it doesn't seem like I can customize them all that much. So custom Tab Bar and Navigation Bars, and then implemnt the segues and button changes programmatically?
Thanks.
I will try to guide you from an architectural perspective (so you won't find much code below).
Using a UITabBarController
In order to achieve what you are suggesting, you are right you cannot use a UITabBarController straight away, among several reasons, the most immediate one is that they are meant to be always at the bottom and you want it in top (check Apple's docs). The good news is that probably you don't need it!
Note: If you still want to go with a UITabBarController for whatever reason, please see #Matt's answer.
Using a UINavigationController
You can use a UINavigationController to solve this task, since the UINavigationBar of a UINavigationController can be customized. There are multiple ways on how you can organize your view's hierarchy to achieve what you propose, but let me elaborate one option:
To customize a UINavigationBar's to add buttons, you just need to set its navigationItem's title view:
// Assuming viewWithTopButtons is a view containing the 3 top buttons
self.navigationItem.titleView = viewWithTopButtons
To add the burger menu functionality on a UINavigationController you can find several posts on how to do it and infinite frameworks you can use. Check this other SO Question for a more detailed answer (e.g. MMDrawerController, ECSlidingViewController to mention a couple).
About organizing your view hierarchy, it really depends on if when the user taps one of the main top buttons, it will always go to the first view controller in the new section or if you want to bring him back to the last view in the section where he was.
3.1 Switching sections displays the first view of the new section
Your app's UIWindow will have a single UINavigationController on top of the hierarchy. Then each of the 3 top buttons, when tapped, will change the root view controller of the UINavigationController.
Then, when the user changes section, the current navigation hierarchy is discarded by setting the new section view controller as the UINavigationController root view controller.
self.navigationController = [sectionFirstViewController]
3.2 Switching sections displays the last displayed view in the new section
This will require a slightly modified version of the above, where your each of your sections will have its own UINavigationController, so you can always keep a navigation hierarchy per section.
Then, when the user taps one of the top buttons to switch section, instead of changing as previously described, you will change the UIWindowroot view controller to the new section's UINavigationController.
window.rootViewController = sectionNavigationController
Using a custom implementation
Of course, the last and also very valid option would be that you implement yourself your own component to achieve your requirements. This is probably the option requiring the biggest effort in exchange of the highest customizability.
Choosing this option is definitely not recommend to less experienced developers.
I'd like to take a stab at this--I think it is possible to use a tab bar controller here.
Your topmost-level view controller will be a UITabBarController with a hidden UITabBar.
Each tab is contained in a UINavigationController.
All view controllers in the navigation controller will be a subclass of a view controller (say, SwitchableViewController).
In SwitchableViewController's viewDidLoad, you set the navigation item's title view (i.e. whatever's at the center; self.navigationItem.titleView) to be the view that holds the three center buttons. Could be a UISegmentedControl, or a custom view.
Whenever you tap on any of the buttons, you change the topmost UITabBarController's selected index to the view controller you want to show.
Issues you may encounter:
Table views inside tabs will have a scrollIndicatorOffset at the bottom even if the tab bar is hidden.
Solution: Play around with the automaticallyAdjustsScrollViewInsets of the tab bar controller, or the inner view controller. https://stackoverflow.com/a/29264073/855680
Your title view will be animated every time you push a new view controller in the navigation stack.
Solution: Take a look at creating a custom transition animation for the UINavigationController.

Xcode6: Navigation Bar is overlapping textfield

I am using Xcode 6 and the tutorial I am following is using a version of Xcode 4 and so this is another issue that has turned up (I followed tutorial exactly).
So I created two initial scenes - a log-in and a sign-up scene, both of which have a username textfield at the top and then a password textfield directly below it. I then added buttons below these text fields.
Now I have a problem where my top-most UIelement, the username textfield, seems to be overlapped by the navigation bar, in that I can't see the username field anymore.
I can see that the username text field exists when I look in outline, but have to double click on the navigation bar on top to see that field on the storyboard canvas.
I have a navigation controller set up. Embedded in it is a table view controller which links to the log in and sign up scenes - a show segue goes from the table view to the log in scene, and then another segue goes from the log in button to the sign up scene.
As well as the navigation bar blocking/overlapping my username text field, oddly there doesn't seem to be a Navigation item in outline for these two scenes- only the Button item and the text field items are there under the log in and sign up scene.
I thought that maybe I hadn't added the navigation controller properly and that it wasn't linked to these scenes, but when I run the program the navigation bar is there for all scenes, and anyway I can see it as a rectangular block at the top of my view (again for both scenes).
I need to make my Username text field visible, but also keep the navigation bar.
Is there any straightforward way to do this with interface builder or auto layout?
Would really appreciate any help.
I found a solution. I double clicked inside the navigation bar area where the textfield is hidden, and from there selected Drawing > View > Hidden.
The hidden checkbox was unchecked, so I checked it, and that made the username field visible inside navigation bar (strange!) and I then dragged it out of there and moved it to be underneath the navigation bar.
I would still like to know whether there might be a better way to have done this, I'm sure there is! But this is some kind of solution at least.
(I still cannot see navigation item in my scene outline)

UI keyboard not appearing when UI textfield tapped after model to a different view controller

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?

Resources