TableView with detailed view - ios

I little confused with configuring detailed view with MMDrawerController and without navigation controller.
I have TableView with custom cells inside ViewController. When users presses cell i want to show another ViewController with details about selected item. For this case i use didSelectRowAtIndexPath method from my tableview.
There are many cells in my table, that is why when user presses "back" button on detailed view i want to navigate to selected cell not to the top of table. What types of segues i should use?

Related

reload collection view by press back bar button item

I have a collectionView in my app that when the user taps one cell of it, the collectionView will reload data, in detail, I have an album that it could contain another album when user choose one of them it shows albums inside of that.
Now I want when user click on backBarButton the past data appears on collectionView (super-albums), but now backbarButton shows the past VC.
I use navigationController and show module segues between VCs.
Q: How should I implement that?
If your changing view on collection cell press. you can reload the collection view on viewWillAppear.

Passing Data with a button

I have an app(my first) that has several view controllers.
VC1 - is an tableView with a name & image. (a list)
VC2 - is a View with name, image and two buttons. (list add/edit view)
Data passing between these two views works fine using protocols
VC3 - is a tableView with another list. (items for first list)
I have a Button on VC2 that segues to VC3.
So a user enters the first TableView and taps on a tableViewCell, it segues to the second View for editing that selected list. While in the second View(not a tableView) the user taps a button which segues to the third TableView to add/edit the items. Then the user taps the done button sending the user back to the second View.
This is my issue - how do I pickup/associate the list name from VC2 to VC3. When the user taps doneButton the items should be associated with that one list that the user was editing.
thank you, newbie
Here is a good tutorial from apple showing you how to do just that. The basic idea is that to add things to a table view. Have an array of objects in the VC1 that contains everything you want to show. Then pass that array to VC2 (which in turn passes it to VC3) using prepareForSegue. Here is a good segue tutorial.
For editing (moving and deleting cells), this had native support so you won't have to roll your own. The bottom of that tutorial link shows how to enable this.
The basic idea for deletion is that you want to remove the element from the array and then redraw the table view (VC1) without that element. Failing to keep the table view and array in sync will result in a crash.

Call segue with Disclousure indicator won't work

My question is very similar to this:
Disclosure Indicator doesn't call seque while Detail Disclosure does
But is a bit different.
The same is happening to me. I have a dynamic table view which loads some rows at viewLoad.
So I set the segue from the Cell to a new View which will show some details of the item. I also set the Segue to Push.
When I do that, the Cell automatically sets its Accessory to Detail Indicator (So the blue info button appears) This works fine, I click on the info button and it loads the new view. But I do not want that, I want the Cell to have a Disclousure indicator (the arrow) and whenever you click on the entire row, just Push the new view. I did this on an Static Table View and it worked fine, but I can't make it work with a Dynamic Table. Nothing happens when I click, just the animation of the tap and nothing else.
No, it's not ok to change an accessory action segue to a selection one by setting the accessory to none -- that doesn't change the segue type. The fact that you got the blue button when you made the segue means you chose an "Accessory Action" segue. When you drag from the cell to the next controller and let go, you get a menu of choices that's divided into two sections. The top ones are Selection segues, and the bottom set are Accessory Action segues. You need to delete your segue and remake it, being sure to choose from the Selection segue choices.

Adding TableViews to TabBarView & how to customise prototype cell

Im building my iphone application and this is how my storyboard looks right now.
First question: Adding another table view
My first two tab bar items are going to contain table views. Now as you can see i have my first table view connected and all, how would i do to get the empty view under Navigation Controller to be a a Table View. Would i need to add another Navigation controller? or how does it work cause i have never worked with tabbars/tableviews before.
Second question: Customize prototype cell
My first Table View can show the data that i inputed as you will see in the following picture. The first picture is how its currently being shown. How can i make a custom prototype cell that would look like the second picture?
Please not that the cells will be very much alike each other in both of my table views. I will have an if statement where i will check a specific thing and if its true it will hide for example the image but all the other things would be the same so would i make a class for the cells?
For better solving your questions, You must first understand the purpose of Navigation Controller. Navigation Controller is there for you to push and pop between controllers, which is convenient when you have levels of data. It manages a stack of controllers. You don't always need a navigation controller to work with tableview. However, it's a common practice to put Navigation controller and TableView (with view controller or solely UITableViewController) together for easy showing levels of data.
Basically, there are two ways to add a TableView. You can directly drag a table view onto your empty view controller or delete the empty VC, then drag a UITableViewController. Most importantly, select the whole VC and go to Editor (at the top) choose embed in a Navigation Controller.
Link about navigation controller from Apple's document
Since you use storyboard, you can directly customize your tableViewcell in storyboard. You already have a prototype cell. You can now directly drag UIImage or Label on that. Most importantly, create a class subclassing UITableViewCell and connect objects in your tableViewCell as an IBOutlet so that you can control it. If you feel plain text explanation is not enough, I find a tutorial for you.
You could refer to the link section Prototype Cells.
1) Yes you will need a 2nd navigation controller for each tab.
Delete the UIViewController.
Drag a UITableViewController to the storyboard.
Embed the UITableViewController in a NavigationController.
Set a segue from the tab bar button to the new NavigationController.
2)
To fully set up the prototype cell you showed you will need to create a new class which subclasses UITableViewCell and then set IBOutlets for all the labels etc.

prepareForSegue: is not called after tapping a row in UITableView

I have a UITableview, which has a list of cars. On selecting any row, a UIViewcontroller is to be shown, showing the details of the car selected.
However, prepareForSegue: is not getting called when I tap on any row in the Search Table View Controller.
After searching on the internet, I looked at a few examples and I tried to follow them to do this job, using [self performSegueWithIdentifier:#"ShowProductDetail" sender:nil];
in my didSelectRowAtIndexPath: method. It performed the job, but now I don't see a BACK button. I need the BACK button in the navigation bar in the new view controller, which is the selected one in the image:
I was just missing my cellIdentifier for the prototype cell.

Resources