How do i add UITableView in the UITableView cell? - objective-c

I Have one tableview(First) in that i want another tableview(Second) in the cell of first tableView.
In short i want each cell contains one more tableview.
So help me out with this problem.
Thanks in advance.

Although I think the below method is better this tutorial shows you how to create a tableView inside of another tableView http://iosstuff.wordpress.com/2011/06/29/adding-a-uitableview-inside-a-uitableviewcell/
My Solution:
That approach is bound to run into serious problems, so I suggest scrapping it. If you have nested table views (or scroll views, more generally) then the scrolling behavior of the views will be erratic. A better solution is to use variable height table view cells: you just create the cell view to hold all the multiple choice options you need, and implement
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
in your table view delegate to supply the heights of the cells.

Related

Expansion for a view-based NSTableView

I have a view-based NSTableView for which some cells have enough content that it doesn't fit. I would like to be able to have the cell automatically expand when a user hovers their cursor over the cell.
In searching for this, it seems that this is the default behavior for a cell-based NSTableView. There are even methods like shouldShowCellExpansionForTableColumn, which the doc says is for cell-based table views only. Somewhere else in the doc implies that this expansion behavior is even on by default for cell-based table views?
- (BOOL)tableView:(NSTableView *)tableView shouldShowCellExpansionForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
I get the impression that I'm missing something obvious.
Goal:
Be able to put multiple rows of NSTextField objects in a view-based cell (more than there is pace to handle)
If the content overflows, put a visual indicator into the cell
When the user does a tool-tip style hover on the cell, expand the view to show all the content
You seem to be on the right track as this should work for cell based NSTableViews. You need to put tableView:shouldShowCellExpansionForTableColumn:row: in the tableView's delegate. You could reply YES for the column of interest.
With a view based table where you use NSTextFields these scroll, truncate or wrap but there is not an expand on hover option. It is possible to set the tooltip text to be the same as the content which might be a reasonable solution.
Did you try to change the row height (tableView:heightOfRow:) triggered by some mouse action? You might have to reload the tableview.

Updating UITableView within UICollectionViewCell

I have a UICollectionViewCell containing some buttons, label and a UITableView. This table view varies in number of rows and content. The UICollectionViewCell is the table views data source and delegate.
UICollectionViewController forces me to use [collectionView dequeueReusableCellWithReuseIdentifier:#"CellID" forIndexPath:indexPath].
When scrolling through the UICollectionView the UITableView within the UICollectionViewCell doesn't update its content.
Calling [tableview reloadData] doesn't affect the number of rows.
Calling UICollectionViews reloadItemsAtIndexPaths:(NSArray *)indexPaths seems to be no good choice for performance.
Does anybody know a more clever way to update the table view inside the collection view cell instead of reusing previous cells' table views?
Have you set the delegate properly? If reloaddata is not updating the number of rows, there might be a problem with the delegate settings.

UITableViewCell Accessory Views Duplicate In Defferent Sections When Scroll The UitableView

This question make me troubled for a long time, I want to implement defferent accessory views on different cells in my tableview.
And my tableview have multiple sections, But they duplicate onto other cells in my other sections that I have not implemented when I scroll up and down the UITableView. I know someone said "It should be Use different identifiers when you assign dequeueReusableCellWithIdentifier: for each cell in cellForRowAtIndexPath: method before,
But I don't know how to implement programmatically in detail, Anybody can write a sample code in detail help me to understand?
Thank you very much!!!!!
Its all well and good to use different accessory views. But you have to keep in mind that if you are recycling cells, then you first try to recycle, if none available you create a cell, THEN you need to set the appropriate accessory view for the particular cell you are going to return. Who knows what the old one was for a recycled cell...

UITableView within a UITableViewCell

I need to load a UITableViewCell xib into the root controller of a split view. The UITableViewCell contains a UITableView as a subview (designed in Interface Builder). This UITableView will be used to load other cells. Is the loading of the UITableView within the UITableViewCell possible to achieve??
In short - a cell with a tableview as a subview that loads data from DB.
I have tried this but with little success. The problem is that the delegate method...
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
..placed within the UITableViewCell implementation file, never gets triggered.
Please help.
Your design may be ill advised, however...
If you have code for your UITableViewCell class, then that object needs to be the data source and delegate for your embedded UITableView. Something, certainly, has to be the tableView's data source and delegate, of course.
Another best practice, in this case, would certainly to be to make sure that the tableView argument in the various data source and delegate methods is the tableView object you think it is before you do anything.
How many custom table cells with embedded table views are you planning? Why not use a single table view with Grouped style? Eacn section of the table can then contain the content that you are now putting into your UITableViewCell/UITableView element. Would certainly be simpler, and might achieve the same result.

Selection of tableview cell's index path

I have a question regarding the selection of table cells.
I have three grouped tables which are used as forms, only one of which should be in view at a time. So in the nav controller I have a button which presents another table in a popover with the title of all three forms and will control which form is currently available. So to show only one at a time manually is easy enough, but how do I go about detecting the selection of a certain cells indexPath upon selection and communicate that selection with another view controller?
You are getting it as part of
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
for the table view delegate.
Also, it might be worth considering using a segmented control for the selection.