Push a UITableView modally as a 'transparent layer above' my current View - objective-c

I need your help.
I want to push a UITableView modally as a 'transparent layer above' my current View.
The TableView exists already and I want to reuse it in a slightly different context.
So the User creates a new Object inside the View, he gives it a name and a description and a topic, when he does so I want to show all existing topics(the TableView) and pick one, then the TableView should disappear.
All its functionality is exactly like usual and it isn't allowed to cover the NavigationBar.
So my Question: is that possible and how?
I hope I could make myself understood.

If you want to present a tableviewcontroller which will be transparent over your view controller, it is possible .
Create your tableviewcontroller instance and before presenting the viewcontroller add the following code.
tableVC.providesPresentationContextTransitionStyle = YES;
tableVC.definesPresentationContext = YES;
[tableVC setModalPresentationStyle:UIModalPresentationOverCurrentContext];
In your tableVC set backgroundcolor to clearcolor It might work

Related

Segue from Custom Cell (dynamic Prototype Cell)

Im using the Storyboard to create my UI.
I have a SplitViewController. The MasterViewController holds a TableViewController where I created a CustomCell with Custom Design.
The Cells are shown pretty good with my data.
The point is: The Custom Cell also holds an Info-Button, with should Popup a little 300x88 TableViewController with some data.
If the Cells in my MasterViewController->TableViewController where a Static one, I just would drag & drop a Segue from the Info-Button to my Popup-TableViewController.
But sadly I cant do this with a dynamic Prototype Cell... I just get the error:
Couldn't compile connections ... >> anchor >> UIButton...
So how can I implement this?
Kind Regards.
Define a manual segue dragging the whole master view onto the detail view, then add a manual target/action to your custom info button and perform the manual segue there. Of course you must set a segue identifier in the storyboard to later reference it in the code, IB will tell you if you forget to.
Instead of connecting and creating segue from individual cells, you can connect all those segues from the View Controller button, lying below your view in your storyboard. In this case, you will have multiple segues and none of them will be individually connected to cells. And when segues are ready, you can use this method for moving on to the next View Controller depending on which cell is tapped from the tableView.
[self performSegueWithIdentifier:#"yourSegue" sender:nil];
You just have to check which cell is tapped and then perform the appropriate Segue on tap using the above code and the respective segue identifier. The prepareForSegue method will be called immediately after this method is called.
Look out for the yellow button as shown below your View Screen in your storyboard.
Drag and drop a segue from that button onto the View Controller that you want to connect.
Hope this helps.

Custom Table in UIViewController Objective-C

I want to create table view inside of UIViewController like a below picture (I mean the second screen)
what is the best solution? "creating UIViewController then tableView and inside of tableView having custom cell"?
would you please give me some hint?
Thanks in advance!
So basically you want the tableview to not fill up the entire space. Yes, you can surely do UIViewController, let it implement UITableViewDelegate and UITableViewDataSource protocols, throw in a tableview and hook up the protocols, and use custom cells.
If you only want the tableview to not fill up the space horizontally (but it can still scroll all the way until it reaches your navbar), then you can just create a UITableViewController, and set up your cell background in the way you want. More specifically, you create 640px (or 320px) wide background images still, but only the central 600px, say, is filled in. The 20px to the right and left are transparent. (You need png to do this, of course) If you apply this background to your cells and apply another background to your self.view, then you can actually see your view background under the 20px on the two sides.
Note that if you choose the second approach, the cells are still full width; it's just that you are visually making them look like narrower. That's perfectly ok, but you need to customize your highlight background, too.
Looking at your picture, it seems you need to create UINavigation Controller as your parent view controller and add UITabBarViewController as its rootview. then in your second tab when your click on the cell inside the table, you pushview to another view which displays your picture
create a tab bar controller project. Every tabbar item will be a navigation controller.
Tat way u can manage both the navigation and tabs.

Combined UITableView with other elements - how to create and use the view?

Ive a project close to doing everything I need it to do. Its got a Main page which has four buttons that allow you to choose an option. Then a tableview page is launched from those options and displays a parsed XML feed from a website. You can then select one of the options in the table to see a detail view of the item, enquire about it, etc.
My problem is I need to add more elements to the TableViewController page, other than the tableview itself. I want a customized back button (not the navigation controller standard) plus some labels, images, etc.
In the TableViewController xib, the tableview itself fills the page. I cant resize it to add more elements above it. I can add a 'view' window seemingly above the tableview and put things in it. But it seems to add the view to the tableview. This means that when I scroll the table, the other elements like new back button, scroll away as part of the table.
So I'm led to wonder whether I need this page not to be a tableviewcontroller, but a viewcontroller, with a tableview inside it, as well as my other view with buttons, etc. Is that the right way to go? But if thats the case, then how do I instantiate the tableviewcontroller within code? Because my page will not be of that type anymore - it will be just a viewcontroller. But in code Im making a tableviewcontroller .. slightly scared by that route tbh.
Any illumination on this would be much appreciated, as various searches have left me none the wiser. Thanks.
To customize it, this is the way to go:
Change your class to be a view controller instead, which implements the TableViewDelegate and TableViewData Source protocols.
In the view didLoad of you controller, create the table view, set its delegate, data source, and any other properties you wish and add it as a subview to your view.
tableView = [[[UITableView alloc] init] autorelease];
tableView.delegate = self;
tableView.dataSource = self;
// .. Other customization
[self.view addSubview:tableView];
I suggest doing this programatically rather than IB.
Instead of a UITableViewController, you want a UIViewController that has an IBOutlet UITableView. Drag and drop a UITableView component from Storyboard and hook it up, and position it as needed on the screen. This UIViewController should implement the UITableViewDelegate and UITableViewDataSource methods.
Edit: Remember that a UITableViewController is just a subclass of UIViewController so you don't really have to get rid of all your code. :) You only need to make minor tweaks to your header and main file, and change the Storyboard to be a UIViewController instead of UITableViewController as I mentioned above.

UISplitViewController: how to get toolbar if details controller is UITableView?

I checked out Apple's example on how to exchange detail views in the UISplitViewController and it seems that they put the UIToolbar in every detail controller. Then, if the device is rotated, they hide the toolbar or show it and add a popover button which will show the root controller.
I'd like to adopt this pattern to show my root controller in a popover using a button in the toolbar, but unfortunately, my detail controllers are all UITableViewControllers and they do not allow adding other UI elements than a table view. So how do I deal with that? Is there an example around?
René
I think I figured out by myself: DON'T use a ´UITableViewController´ and a UITableView as root view in your NIB, as you cannot add a UIToolbar to the table view.
Instead: In the NIB, put a standard view and drag a UIToolbar and a UITableView on it.
Connect the standard view to the controller's "view" outlet.
Add another outlet and make it a UITableView. Connect the table view to it.
In the code: Let your controller inherit from UIViewController and not from UITableViewController.
Add a property to your controller to get the TableView to make it look compatible to UITableViewController.
public UITableView TableView
{
get { return this.viewTableView; }
}
Upon the viewDidRotate event you will have to adjust the table views width and height now (UITableViewController did that job for you before):
this.TableView.Frame = new RectangleF(0, 44, this.SuperView.Frame.Width, this.SuperView.Frame.Height);
The 44 pixels com from the parent view's toolbar.
I don't miss UITableViewController. I know there are some issues like automatic scrolling when editing, but in my case this is simply not needed.
René
Check out this example and the corresponding code. If I understand your question, this should show you how to do what you're looking to accomplish.
Also, just as an FYI to everyone, another MT user MonoTouched the MultipleDetailViews example that you linked to above.

difference between presentModalView and addSubview?

When revealing a new view, what are the differences between these two and when would you use each?
Also, what's the right way to nest views. for example, I have a UIImageview that animates onto my view and it has a button on it. I want to put that image and the button in their own view, then simply animate the view and have both handled simultaneously.
Thanks!
For the first question :
presentModalView is you show another viewcontroller (called modalViewController) to get some data, temporary view... (more about ModalViewController here) . Generally, it is another view and can hide your original view
addSubview: you add another view in your current screen, you don't show another view. Which means you are still in your current viewController.
For the second question:
I will go for presentModalViewController here. You can create another UIViewController contains a UIImageView and 2 buttons then you can just present it