How to edit floating view added to scene dock in storyboard? - ios

I have a view controller on my storyboard set up with a tableview. I want to have another view as a floating view on top of the table view. So, I drag a view (actually a toolbar object) and drop it into the scene dock so that in code I can add it to the subviews and position it so that it floats. I have no questions about the coding; just laying out the view in storyboard.
How do I open the view object that I added to the scene dock so that I can add buttons to it, etc., and design it visually?
I know it's possible since I did it accidentally in another project. The toolbar was in the view controller's scene dock and displayed separately with it's own scene dock. It's very frustrating knowing it can be done, but not knowing how to do it!
(source: bikibird.com)
!

Okay, this is how I did it (also by accident).
I had created an (IBAction) and was trying to connect to a button. So I drug a line from my code to the button (in the list of items). For some reason it wouldn't connect so it seemed to hover over it for a few seconds.
All of a sudden the view (with the button) popped out and displayed next to my uiviewcontroller just like you described. I had done this also by accident, but this is the first time I managed to get it to work for me.
Let me know if this works for you as well!!!

I dont know how to show a view like in your picture, but to design a view visually i put it, for example, as head view on my TableView, design it and put it back to the dock.
It's only a workaround, but that helps me.

All I had to do was drag a UI object (in my case it was a UISlider) from the object explorer on the right into the view I wanted to pop out in the scene explorer on the left

Related

iOS Storyboard: Views outside of the ViewController and on Top of the Scene (between First Responder and Exit boxes)

I am having a hard time understanding why you can put UIViews outside the UIViewController on the storyboard, and what the use case of it might be.
For instance, on the storyboard I can add UIToolbar, UIAcitivtyIndicator and UIProgressView that is outside of the UIViewController. Is this mean there is a way for you to reference those Views that are outside UIViewController and potentially display them somehow either programmatically or embed those like you would do with a ContainerView?
Yes, it absolutely is possible to do what you're describing!
When you add objects that are outside the view controller, they appear in what Apple calls the "Scene Dock". Apple has the following suggested usage for the scene dock:
If a view is not part of the main view hierarchy — such as a pop-up
menu — add the view to the scene dock. In a running app, the system adds
and removes these kind of views from the view hierarchy when they are
opened and closed.
The steps to make this work are below:
Open the storyboard.
Open the utilities area for the workspace window by clicking the
utilities button in the
toolbar.
In the utilities area, select the Object library by clicking the Object Library button in the library bar.
On the storyboard, select the scene to which you will add the extra view.
Drag a view class object from the object library into the the scene dock.
And importantly...
The added view is a part of the view controller. It will be
instantiated along with the rest of the views. You can attach the view
to a property of the view controller that has an IBOutlet. You can add
more than one view to the scene dock.
(These steps were originally copied from here - unfortunately this page seems to have been deleted by Apple at some point).

What's the proper way to implement complex custom view controllers

Note: I'm not talking about custom view controller transition effects which can be done by using a custom view controllers it's the iOS 5+ API.
I'm talking about transitioning to another view controller, where a view from the presently displayed view controller is animated to the view controller to be presented's view.
EXAMPLE
-you have friendsViewController which displays a list of the current users friends. Each table view cell has a profile picture and name.
-click on a cell, all other cells fade away and the name and picture animate to the top. At this point, UserProfileViewComtroller is displayed.
THEORIES
-I could easily do this by combining the two view controllers, but UserProfileViewComtroller can be launched from other parts of the app.
-if the UserProfileViewControllers view is instantiated, I could convert the coordinates using UIViews methods
I feel like there is a more appropriate/cleaner solution here which is why I'm asking the community for help :)
It seems to me that what you want is exactly about view controllers transition, since you want to do 'something' that would look to the user as if you took a view from old VC and moved it to the new VC.
Then you're in luck, as you're allowed to move a UIView from one view controller to another using [superview addSubview:view] as part of the transition you want to do.
This can be done on any iOS version, although it's easier now as in iOS 7 there's a delegate you write (see <UIViewControllerAnimatedTransitioning> reference) which has access to both VC's view hierarchies and can change them at will (move one view, fade other views) during transition period.
Also, making your new view controller during the transition transparent (or using old controller's snapshot) will help you hide the fact that VC changed.
Not so much an answer but a technique that might inspire a solution. I did an app that had need for a custom transition like this. The original app arranged itself then took a snapshot, so at the last moment the user is looking at an image. The second viewController was created, given coordinates etc, and the image, then shown immediately. It put the image into its view (subview with same bounds).
At this point the second vc has complete control, and can fade in some other content etc. the reverse was more or less as the start - the image is used, swapped, used removed to uncover the real view content.
Note that this took a bit of time to get it working with no glitches etc.
EDIT: if you are concerned in turning the whole original view into an image, then modify the technique. For instance, in the original view, fade all other content to black but the cell, then snapshot the one cell. The second view will start with an all black background, and place the cell image over top it, then go from there.
EDIT2: As mentioned in the comments, you of course push the second view with no animation, so it happens instantaneously. By setting a small image on the second vc, with an agreed upon background, you can quickly "pass the baton" so to speak and let the second controller go to work quickly and seamlessly.

Main view is moved on returning to ViewController from next one?

I have a view controller with multiple UIViews on it, made in two different ways, all sitting in a scrollview. The top one was added through storyboard, and was done so to make it easier to style and work with segues. The others are more of a newsfeed post type deal, and are dynamic, so they are programmatically added. When I travel to another ViewController from this one, and I'm not scrolled all the way to the top I find that when I return, my storyboard added view is moved up, and almost out of the screen.
How do I fix this? I feel like it has something to do with the scrollView or the fact that it was added in storyboard, since the other views dont move, just this one.

UIButton is Filling Screen

I have a problem where the button's I have added to .xib file are filling the screen when I run the application in the iPhone simulator. In Interfacce Builder, the UI appears exactly as I want it. It is added in Interface Builder, and it is correctly linked to the proper view controller. The button is not being manipulated in the code. Code someone point out some settings to check. This is an error that has been there for a few and days, and I can't seem to fix it.
The view hierarchy is (if this helps):
MainWindow
TabController
FirstView
SecondView
ThirdView
In FirstView.xib, in the document outline under objects, there is a root view, which contains the UIButton in question.
One possibility is that the button is added as the view, instead of a subview of the view. It sometimes happens, when you move a button around -- particularly from within the hierarchy list, it accidentally becomes the view (of the viewController) instead of be a subview.
Most probably is that you have not configured correctly the resizing of the button. You can either set it in code or using the interface builder.
For the interface builder solution select the button and open the "Size Inspector". You will see that there is an autosizing feature, adjust to your need and you are done.

Gesture starts in one UIView, continues in another?

In brief: Is there a way to hand-off an in-progress drag gesture from one view to another?
More detail: I'm working on an iPad app. Imagine a situation where there's a playfield in the middle of the screen. On the borders are a bunch of "pieces" that can be dragged onto the playfield.
When one of the pieces is dragged onto the playfield, I want its appearance to change. Though it might be simplest if I had a single view that transformed its appearance when dragged onto the playfield, in my particular case, it's simpler if there is one view for the off-playfield appearance and another for the on-playfield appearance.
The trick is this: while I'm dragging the piece onto the field, I want the drag to continue on once I've gotten rid of my "off-playfield" view and added my "on-playfield" view. Essentially, I want to hand-off the gesture from one view to another, while the user goes through one continuous drag.
Is there a way to do this?
UPDATE: Actually got this working using the single-view approach, but am still curious as to whether a gesture hand-off can be done...
I think this isn't possible. What is possible is to have a parent view that contains the "before" view and "after" view. As the drag occurs, that parent view can switch between the two views while maintaining the drag.

Resources