I'm trying to pop up a view controller from the bottom of the screen but I want a view from its parent view controller to show on top of it so that it slides up from underneath this view. There's no interactivity with this extra view on top of everything. Is there a reasonably simple way to do this?
There are various ways to achieve this:
You can create a xib and add over the view controller.
You also create a programmatically view and add over the VC.
You also can drag view over the VC in storyboard and initially hide the view.
Show with the animation.
Related
I created a MasterViewController project with a tableView, now I'd like to add some tabs to this. I tried to just drag and drop the tab bar into the MasterViewController and the tabs show, but they are linked the the last cell in the tableView.
Is there any way to make the tabs stay in place so they are always displayed? What I am trying to accomplish is to give the user buttons to push to organize the data in the tableView, so I'm open to other suggestions.
Here are the pictures:
You need to have your controller be a UIViewController, not a UITableViewController (where the table view is the controller's self.view, and is full screen). If you use a UIViewController, you can add a table view, and size it such that you have room at the bottom to add the tab bar. In that case, both the table view and the tab bar are subviews of the controller's self.view. The way you're trying it, the tab bar is added to the table's scroll view.
It sounds like you added it as a subview of the table view, so as the table view scrolls it scrolls too. Look at creating a container view to hold both the tableView and tab bar / segmented control / buttons positioned below it. You will need to make the controller a subclass of UIViewController instead of UITableViewController.
Alternatively, use the navigation bar to add some edit button(s), either to enter an editing mode which shows controls on each row or where the buttons actually edit the currently selected row.
Tab bars are container controllers and are used to present a different mode of your application. If you want to only organize your tableview data, my suggestion is to use UISegmentedControl.
I am having trouble to find out the best way of transitioning only a part of view controller.
This is what I have:
In my first view controller, I have a UIView that acts like a header where I provide some ImageViews and Labels, bellow it I have a table view.
When user clicks a cell from the table, another view controller is pushed and it contains the same UIView header as before and bellow it some detailed information about the cell item selected.
This is what I want:
Since both view controllers have the same UIView header, I would like it to be fixed and only change the bottom contents (table view or detailed informations). I expect a transitioning effect that only move the contents on the bottom.
I appreciate any guidance.
A View controller controls views, so it isn't a case of transitioning view controllers, you can do this by transitioning views.
You can have multiple views. that occupy portions of the window.
In your case you could keep the top view (the one that you call the header) and when you need to change a part of the view your controller just needs to create a new view to display and then you can animate it into it's new position on top of the old view.
UIView animations let you accomplish this. For example, you could use transitionFromView:toView:duration:options:completion: to animate from your table view to the detail view.
It is possible to have a different view controller for this detail view if you want. All you need to do is create the view controller with the information that is needed to configure its view, and then pass this view as the toView to the above method, and then when you are done with the view, you can use the same method to transition back to the original tableview.
Im writing an application which the main view controller is a UIViewController. It has some icons in a grid and I want to dismiss (sliding down) this grid when one of the icons is clicked. This I've done already. The problem is: when the grid is dismisseed I want another View to come from the top of the screen. This view is in this same root view controller. But I want to display the content of other view controllers in this view. For example: I want this view to show a UINavigationController with a UITableView inside it, so the user can navigate through TableViews.
I'm doing this:
HorariosViewController *horarios = [[HorariosViewController alloc] init];
[vuashView addSubview:horarios.view];
HorariosViewController is a UINavigationViewController. It shows me only a blue NavigationBar and changes like self.navigationItem.title = #"Title" won't work.
Thanks!
You can show another view controller's views as subviews but their outlets and actions remain linked to their original view controller unless you write code to make new connections, so self.whatever shouldn't be expected to affect the other view controller's properties.
(Also, if HorariosViewController is a UINavigationController, it shouldn't be created as a UIViewController.)
One approach is to have the navigation controller already there, with the icon grid presented modally on top of it. (you can set the view up this way without animations, so the user doesn't see the navigation controller underneath).
Then, when it's time for the grid to go away, it can call dismissModalViewController on itself with animation.
I have an app built from the UITabBarController starter project. The first tab is part of the main.xib that contains the tab bar. I would like to slide a view up from the bottom on top of that tab's view that only covers part of the screen. My understanding is that you can only cover part of the screen if you make the top view non-modal, but I don't see a way to do that without a NavigationController.
How can I do this?
you can add a UIView as a subview to the current view, and then animate its appearance into the screen using animation blocks, or Quartz or however you would like.
presentModalViewController: is actually a method that belongs to UIViewController, the superclass of UINavigationController, so you can use it from any view controller, not just a navigation controller.
Have you tried using a UIActionSheet? That's an easy way to get a view with a few buttons for user input to slide up and only cover the bottom portion of the current view.
My app is using a navigation controller and it has a navigation bar, a table view and an image on each view. Those elements layout from top to bottom with no overlapping.
Now because I have the exactly same image for every view (a logo), is it possible to animate only the navigation bar and the table view while the views push and pop? I want the logo always stays on the screen.
Thanks in advance.
Interesting idea. You might try adding the view directly as a subview of the navigation controller's view, rather than making it part of any of the controllers it manages—in that case, you probably also want to give the view a particular tag, then retrieve a reference to it in your individual controllers' -viewWillAppear:animated: and call -bringSubviewToFront: with it on the navigation controller.