Xcode Embedded navigation controller back-button not showing - xcode

I've just started learning Swift and Xcode, so I apologise in advance if my question is confusing or missing information. Please let me know if that's the case.
My question is on the automatic navigation bar created when I embed my scenes in the navigation controller.
As I've tried to show in my screenshot in the link below, my idea is to use the "Refusion" button in scene 1 to show scene 2. This works. However, scene 2 does not generate an automatic back button this way, which is what I'm trying to get.
If I create a button in scene 2 that shows scene 1 upon being pressed, scene 1 will now have an automatically generated back button. But this sends the user/me back from scene 1 to scene 2.. Which I already have my "Refusion" button for and also it just creates a confusing loop.
So, my question is: I'm trying to figure out how to get the auto-back button on my scene 2 and just scene 2, how do I do that? I'm probably doing something wrong, but would appreciate any help in where my error is.
I've embedded both scenes in the navigation controller.
Thanks,
https://ibb.co/jfZeSa

You need to embed only scene 1 in navigation controller.
When you tap on Refusion button, push scene 2. Scene 2 then will be added in the navigation stack. In this case default back button will appear on the navigation bar.
In case you present scene 2 from scene 1, back button won't appear on the navigation bar. i.e. scene 2 won't be added in the navigation stack.
Back button on navigation bar only appear on the controllers that are the part of navigation stack.

Related

Preventing UI interaction to the parent view

I have a WKWebView (loaded with Google) in my macOS app. On top of that, I have added a subview (Gray one, with a white box) as follows.
let controller = MyViewController()
self.addChildViewController(controller)
self.view.addSubview(controller.view)
Eventhough my new view is at the top, still I am able to click the links in the webview.
I have been overriding the mouseDown in my view and block the click. But, if I move the mouse over the links, it is changing to pointed hand mouse.
Is there any way to block the user interaction at my new view itself, so that it does not pass through to the webview?
Thanks in advance.

How can I make the top and bottom elements of my view controller stay in place, while the middle has elements to vertically scroll through?

I'm working in Swift 3 and XCode 8.
I tried to find the answer to this question, but maybe I don't know how to ask it properly. I'm trying to have a title bar at the top of a view controller and have a back and next button at the bottom of the view. The content in between is longer than the space that exists, so I would like the user to be able to scroll the middle, but keep the top and bottom elements anchored in place.
I've tried to use a container with another view controller that is larger than the container to make this happen, but it just resizes the child view controller.
If I'm not explaining something properly, please let me know and I will try to give more information about what I've missed.
I'm making a few assumptions about your Views:
Navigation Bar for your title
Toolbar to hold your Back and Next buttons
Try the following:
Place a Navigation Bar as seen below. Do not set any constraints.
Place a Toolbar as seen below. Again, do not set any constraints.
Place a Scroll View in the centre of your View Controller and expand it so that the top and bottom are aligned with the navigation bar and toolbar respectively. Again, do not set any constraints.
Highlight all of the Views in the View Controller and place them in a Stack View.
Pin the Stack View to the Superview. These are the only constraints that are set in the example below.

Unity UI Button not calling the Onclick method

I have a button under a canvas that is suppose to restart the scene. But instead its not calling the intended function of attached script.
On Unity Forums, I found solutions like it should be at higher hierarchy in canvas, and the canvas should have a graphic raycast and so-on.
But it still isn't working, although its on click array detects the intended method it is suppose to call.
Scene Editor with Canvas Selected:
Scene Editor with Button Selected:
Remove the canvas component from your button.
Make sure that there is a GraphicRaycaster on your canvas, and that there is an EventSystem object somewhere in the hierarchy.
(Both should have been added when you first added the canvas, but things get lost)
The screenshot that shows your button being selected, also shows, that you did pick a gameobject for the OnClick event, but you didn't pick a function from the drop down right next to that field, it says no function.
Instead of selecting the C# class, select the GameObject that
btnSceneSelect is attached to.
If btnSceneSelect is not attached to a GameObject, attach it to one
(other than the button).
Taken from this site

Can't get the most basic scrollview to work

This is not my day. I've just deleted every object from my previously completed view controller to start over because I can't get a simple scroll view to scroll. I've got a view controller that is embedded in a navigation controller. I put scroll view inside the view controller and then put two text fields inside the scroll view, one field at the top and one at the bottom.
First of all, when I run this, it won't scroll. What is the point of the scroll view if it won't scroll?
Second, I can't figure out how the relationship between the navigation bar and the scroll view works. Is the scroll view behind the navigation bar? Is it below the navigation bar? In the story board, it looks like it is behind the bar, but when I run it, my text field is pushed down so far that it looks like it is behind it.
Here are a couple of screen shots. To say that I am frustrated is an understatement. Thanks for any help getting me out of my circular problem. I appreciate it.
And here is how it looks when I run it. Notice how far down the top text field gets drawn. Also note that you cannot see the bottom text field. I am unable to scroll to this. What gives?
First of all, when I run this, it won't scroll. What is the point of the scroll view if it won't scroll?
Scroll views won't scroll by default unless their contentSize exceeds their bounds. You can force it to scroll anyway by setting alwaysBounceVertical to YES.
Second, I can't figure out how the relationship between the navigation bar and the scroll view works. Is the scroll view behind the navigation bar? Is it below the navigation bar? In the story board, it looks like it is behind the bar, but when I run it, my text field is pushed down so far that it looks like it is behind it.
Yes, in iOS 7, by default, a scroll view will start at y = 0, behind the nav bar. You use the contentInsets property to push it down. The view controller has an automaticallyAdjustsScrollViewInsets property that can handle this for you.

Xcode 5, ios screen issue

when I open my iOS project in Xcode 5, I see spaces bottom and top of the view controls (in 3.5 and 4 inch screens).
There are no problem in Xcode 4. Image view is not covering all view controls area.
I am setting image view size with manually but I have 200+ view control.
How can i quickly fix ?
Have you tried to hide status bar ?
It can cause the issue you are having
If the spaces are only appearing in Interface Builder, you can tell IB what you want to see during layout. Click below a scene on the bar where the controller, first responder, files owner etc. are located. Now your whole scene is selected. Then show the attribute insepctor (Cmd+Alt+4) and select what you want to see in your scene.
Attention - this has nothing to do with your code! Its just how the scene is presented in the editor (simulated metrics)!
If this was your problem, please mark question solved.
If not, please add some more details.
Thanks.

Resources