If some one please can point me in the right direction.
I have two views in the same view controller and i what that the user can drag up the lower view and make it bigger and the second one smaller.
On the Mac you'd use a split view. To my knowledge iOS's UISplitViewController isn't resizable, but you could try MGSplitViewController or some other open source variant.
Related
(I have read other questions and answers on this topic, but most are very old and do not relate to iOS 9 or 10.)
The app design calls for the top half of the display to always contain the same content. (An image being edited by the user.)
The bottom half of the display needs a UITableView. When a UITableViewCell is tapped, the bottom section needs to transition to a new UIViewController with slide-on animation, similar to how UINavigationController push segues work.
Problem: only the bottom view needs to transition to the new view controller(s), and back again. The upper half of the view hierarchy needs to remain unaffected. For this reason, I can't place everything inside a UINavigationController, and I can't have a UINavigationBar at the top of the screen.
Question: what approach should I take in such a situation, where I need only one UIView hierarchy to transition in push-segue fashion, but not anything else? Thanks.
Edited with Solution
Solution follows, for those following along at home.
Yes, you can actually use a UINavigationController for the bottom half.
If you are using Storyboards, the easiest way to do this is to use a container view for each part of the screen which you then can embed a UIViewController in for the top part and a UINavigationController in for the bottom part. If you are doing this programmatically, just add the view controllers as child view controllers to your app's initial view controller (see this answer for more info) which is essentially what the Storyboard will do for you automatically when using a container view.
As a child view controller, the UINavigationController will act independently from the top UIViewController and should behave as expected.
I recommend the programatic approach for the following reasons:
It helps you understand the inner workings of child/parent view controllers much better which will likely save you a significant amount of debugging time down the line.
It makes adding/removing/swapping child view controllers as simple as a few lines of code. Trying to do this with Storyboards is notoriously hacky and cumbersome.
It's much easier to keep track of changes using GIT (most mid-size/larger companies actually prohibit Storyboards for this very reason)
If you want change in part of the screen you can use container view. For details refer Swift - How to link two view controllers into one container view and switch between them using segmented control?
You can use multiple view in one view controller and can give animation like push or pop to show or hide it.
Second approach is you can use Container View which will give exact effect like navigation stack.
I am writing an iPad app in XCode 4 and would like to create a UISplitViewController instance that displays its viewController references horizontally on the screen. I have been referring to the XCode example provided by Apple (SplitViews) but that example uses a xib to embed two horizontal NSTextViews manually created by the developer.
Is there a way to force a split view to display horizontally using the standard XCode libraries? I've seen a few references to Matt Gemmell's MGSplitViewController class but I am wondering if this can be done using just XCode's standard libraries.
I've also read the thread concerning programmatic split views (here) but there is no mention of forcing the display to horizontal vs. vertical.
UISplitViewController splits the screen into left and right parts. There is no public API (as of iOS 6.1) to tell it to split into top and bottom parts.
You could embed the UISplitViewController's view in a custom view with a rotation transform, and then make each of the contained views use a rotation transform in the opposite direction. That would require you to implement some extra view controller subclasses (and maybe view subclasses). It would be much simpler to just use MGSplitViewController, or to implement your own split view controller.
I have finished iPhone version of my app and want my app to support iPads as well. I used a tabbar controller for iphone.. I could use the same for iPad, however, I would have too much free space on iPad if I use a Tabbar. so I have decided to use Split View Controller. Left part(table view) should be visible all the time even if it's not in landscape mode. And every time a cell is clicked, the corresponding view should be loaded to the right hand side.. By the way I am using storyboards.. Seems like it makes everything more difficult. Are there some examples of it? Thanks..
I have faced a similar situation recently. Basically you can use the split view project template to generate the basic code. After that, I created a DetailedViewControllerContainer interface and used it as the view controller for the right side view of the split view, replacing the generated DetailViewController.
After that I created several view controllers, each of them corresponds to a selection in the left side view(master view controller). And add these view controllers as the child view controllers for the DetailedViewControllerContainer.
The catch is that you will need to use code to load the child view controllers. The benefit is that the child view controllers do not need to be modified from the iPhone version. The DetailedViewControllerContainer remains the only SplitView delegate.
Take a look at the sample code I wrote on github:
https://github.com/raoying/SplitView-Sample
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
I wonder how I can change a splitView.view.frame ?
In my app I'm using a tabBarController to display differents splitViews by tab.
But I need to leave an empty space between my tabBar and my splitView to put another view.
I tried to change the splitView.view.frame but It doesn't work... any idea ?
This is from the Split View Controller section of the View Controller Programming Guide for iOS,
"The UISplitViewController class is a container view controller that
manages two panes of information. The first pane has a fixed width of
320 points and a height that matches the visible window height.
The second pane fills the remaining space."
So, I'd say you can't do it. But maybe someone else has a solution for this.
Word of advice, though: don't complicate your interface. Try and think of a better way to achieve what you are thinking of showing in that intermediate view. Maybe place it somewhere else or present it in some other way.