sakkaras / skstableview Goto Github PK
View Code? Open in Web Editor NEWAn expandable table view.
License: MIT License
An expandable table view.
License: MIT License
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
if i set numberOfRowsInSection is empty and use self.navigationItem.rightBarButtonItem click action "collapseSubrows" to reloadData tableview and then change numberOfRowsInSection not empty return ,application crash
Error at [self.expandableCells[@(correspondingIndexPath.section)][correspondingIndexPath.row][kIsExpandedKey] boolValue];
Hi,
I want to change tableview content by changing content array which fills table. When i call reloadData function i saw that section, row and subrow indexes are kept and used afterwards. Therefore selected section is displayed if it is already selected just before reloadData call. Is there anyway to clear those data?
The subrow value is always zero for Didselectrowatindexpath. Am I missing something? or is the feature not implemented ?
Hello there, I am using this awesome library. Very very thanks for the great animation for cell subViews. I want to expand single cell at one time. As for now, I expands multiple cells. But I want, If one cell is already expanded and user taps on another cell, the already expanded cell should get collapsed.Please suggest me how to do this. Thanks
Thanks for sharing the code, One issue I encountered is that currently all sub cells are default height, How can I adjust the sub cell height for each sub cells? Shall I rewrite the method of "- (CGFloat) tableView:(TableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath" ?
When i use in IOS7. in here objc_setAssociatedObject will crash.
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cell animation stop fraction must be greater than start fraction'
exception when scrolling and selecting ...
[self deleteRowsAtIndexPaths:totalExpandedIndexPaths withRowAnimation:UITableViewRowAnimationAutomatic];
I uncommented the two methods related to row deletion:
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; }
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
But how can I differentiate whether it is subRow to delete or not? And what is the way to call the right indexPath on tableView to delete a row?
[tblView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
I like to look and feel of your design, you've done some great work.
As far as I can tell, the table is static after launch, correct?
Sure would be great if we could use your design and be able to dynamically populate rows and sub-rows.
Perhaps take advantage of NSFetchedResultsController?
When the contents of the list will be the card for more than 13 rows
it is crashing
when i click on sub-row it is not expanding.. but it will get index of sub_row .
It is possible to set a completely UITableView in the expandable cell? I would combine this with a grouped table view.
Hi
i am using this control is works fins but facing one issue i have added one button in cellForSubRowAtIndexPath when i clicked button the i got wrong row and subrow below is mu code
{
UIButton btn=(UIButton)[cell.contentView viewWithTag:15];
[btn addTarget:self action:@selector(DeleteClicked:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)DeleteClicked:(UIButton*)sender
{
CGPoint point=[sender convertPoint:CGPointZero toView:tbl_Preview];
indexpath=[tbl_Preview indexPathForRowAtPoint:point];
// i got wrong indexpath
}
Please help me
thanks
Hi, i implemented the auto-heigh for rows and sub-rows.
Hope to see it on project and help other developers.
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
cell.textLabel.numberOfLines = 0;
...
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForSubRowAtIndexPath:(NSIndexPath *)indexPath
{
...
cell.textLabel.numberOfLines = 0;
...
}
- (CGFloat)tableView:(SKSTableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *item = self.contents[indexPath.section][indexPath.row][0];
CGFloat textHeight = [self getLabelHeightForText:item andWidth:tableView.bounds.size.width];
return textHeight + 20;
}
-(CGFloat)tableView:(SKSTableView *)tableView heightForSubRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *item = self.contents[indexPath.section][indexPath.row][indexPath.subRow];
CGFloat textHeight = [self getLabelHeightForText:item andWidth:tableView.bounds.size.width - 20];
return textHeight + 20;
}
-(CGFloat)getLabelHeightForText:(NSString *)text andWidth:(CGFloat)labelWidth
{
CGSize maximumSize = CGSizeMake(labelWidth, 10000);
CGSize labelHeighSize = [text sizeWithFont:[UIFont systemFontOfSize:20] constrainedToSize:maximumSize lineBreakMode:UILineBreakModeTailTruncation];
return labelHeighSize.height;
}
Is there a corresponding method like didSelectRowAtIndexPath for a subrow or how would I go about doing this?
I have a problem with 'cell.isExpanded' in my ViewController in 'cellForRowAtIndexPath' (in your example this is the 'ViewController.m').
At the beginning of my 'cellForRowAtIndexPath' method I'm asking for 'isExpanded' to do UI changes for the cell. E.g. for a test I log the value:
SKSTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell.isExpanded) {
NSLog(@"row %i is EXPANDED", indexPath.row);
} else {
NSLog(@"row %i is NOT expanded", indexPath.row);
}
When I expand a cell with a lot of subRows and scroll the tableView I get isExpanded YES for cells that are not expanded.
I set 'shouldExpandOnlyOneCell' to YES.
You can test it when you add the log outputs in your 'ViewController.m' in 'cellForRow...'.
Is it an error on my side or do I have to do it in any other way?
Eg:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if ([_SKSTableViewDelegate respondsToSelector:@selector(tableView:heightForHeaderInSection:)]) [_SKSTableViewDelegate tableView:tableView heightForHeaderInSection:section]; return 0; }
Is that a bug?
When I uncomment that method to use, It not work. :))
Is it possible to scroll only subrows of a expanded cell. Like setting a height of expanded row, and scroll whats inside?
Thank you
Thanks for sharing the code, it is a awesome extension of UITableView. One issue I encountered is that currently all cells are not expanded when first loaded, could we specify some row be expanded initially?
I add "cell.isExpanded = YES" in the tableview:cellForRow function, it does not work.
in method didSelectSubRowAtIndexPath
,
has an error: property 'subRow' not found on object of type 'NSIndexPath *'. So my app crash.
Hi @sakkaras, I congratulate you for this great library, it's amazing. Only a little thing, Can you uncomment all the required methods for UITableview. These are really needed to make some action. Thanks for your time.
i create my customCell
SearchResultHeaderCell : SKSTableViewCell
how can add indicatorView with its animation of skstableview cell to my custom cell ?
how to automatic open all subrow?
I have the number of subrows in table more than 5000, wen I want to collapseCurrentlyExpandedIndexPaths the UI will freeze for several seconds. everything is so good except the issue. Hope you can fixed later and update for us.Thanks.
用这个可以做多级(二级以上的列表吗?)
1
1.1
1.1.1
1.1.2
1.2
1.2.1
2
2.1
2.2
这样的数据结构
I want to add this library to my project. I have dropped SKSTableViewImp
folder to my project and I copy all code from the ViewController.h/m of the SKSTableView folder and paste it to mine. Also I have delegate and datasource to my TableView. It is working and I can see the data but unfortunately once I click on the cell it won't expand. Please is this a bug with the Storyboard?
Thanks.
(void)tableView:(SKSTableView *)tableView didSelectSubRowAtIndexPath:(NSIndexPath *)indexPath
{
MyCustomCell *cell = (MyCustomCell *)[tableView cellForRowAtIndexPath:indexPath];
NSLog(@"%@",NSStringFromClass([cell class]));
[cell customMethod];
}
However the cell Calss is SKSTableViewCell . can anyone help me?
can not work on device,but can work on simulator,why?
If the number of row in table more than 10, the UI will freeze and scrolling will become so slowly, everything is so good except the issue. Hope you can fixed later and update for us.Thanks.
Once I go above 10 values and begin scrolling, the UI freezes up. Not crashing, but long lagging during scrolls. How can I fix this from happening
In didSelectRowAtIndexPath, i want to dynamically subrows but this code is not working.
This is my array
_arr_Alphabets = [[NSMutableArray alloc] initWithObjects:
@[
@[@"A",@"A1",@"A2"],
@[@"B", @"B1",@"B2"],
@[@"C", @"C1",@"C2"],
], nil];
trying to insert object a3 after a2
[[[_arr_Alphabets objectAtIndex:0] objectAtIndex:0] insertObject:@"A3" atIndex:3];
error unrecognized selector sent to instance
I can not delete rows by swipe gesture
How should I do ?
Hi - Love the control, just thought I'd share an issue that took me a while to figure out! Unfortunately I don't really know how to solve it but hopefully it'll help
When compiling with the "Standard Architectures + 64 bit" setting on my iPhone 5S, it crashes with a BAD_ACCESS exception when expanding a table view cell.
It occurs on SKSTableView.m line 705 (the objc_setAssociatedObject call in setSubRow: )
The problem, as far as I can see, is that under 64 bit architectures the subRowObj is being treated as a long instead of an int (which it is on 32 bit) as shown below
I've changed my project settings to exclude 64 bit architectures (as in the sample app you provided) and its working fine now
I set the property shouldExpandOnlyOneCell=YES;
1.Open first Row,there are threes subrows.
2.Click the second row (not subrow,there are three subrows,too)
but I got a delegate didSelectSubRowAtIndexPath:
I think ExpandOnlyOneCell,will close subrows of First row First,and calculate corresponfingIndexPath later.
so I modify the SKSTableView.m at 331
marked //NSIndexPath *currespondingIndexPath=.......
and declare this at line 287 before if(cell.isExpandable)
sorry about my poor english.
I need to do some animations according to the content offset while the tableview scrolling; however, the skstableview seems like won't let the function scrollviewdidscroll to be called.
please clarify and help.
thanks a lot.
First of all thanks for your hard and great work.
My first issue is once I click on the first expandable cell and then click on other cell its crash and I get this issue "unrecognized selector sent to instance 0x13f5618f0'" but if I click on other expandable cell's and again click on other cell's expandable or not it works fine. The only issue with the first cell.
It is only crashes when I add the code below with the first cell.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ //Isn't this way to control if it is expandable or not?
SKSTableViewCell *cell = (SKSTableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
if (cell.isExpandable) {
NSLog(@"YES");
}
else{
[self performSegueWithIdentifier:@"123" sender:self];
}
}
My second issue is when the row expand and I select from the sub row I get the cell name instead of the sub row name.
- (void)tableView:(SKSTableView *)tableView didSelectSubRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *selectedCell = [_tableView cellForRowAtIndexPath:indexPath];
_selectedCellTxt = selectedCell.textLabel.text;
NSLog(@"SELECTED %@", _selectedCellTxt);
}
Please I hope you can help me with this?
Is there an easy way to implement a function to close a expanded cell before expanding a new one?
Setting shouldExpandOnlyOneCell = YES is causing the app to crash.
I set _shouldExpandOnlyOneCell=YES
when I expand i row, if clicked another expandable row tableview detect it as a subrow.
I mean correspondingIndexPath.subRow
not 0 for expandable row.
Edit : Abi Türkmüşsün ya :D ben düzelttim bu sıkıntıyı, pull requestle ekledim. #50
NSIndexPath *correspondingIndexPath = [self correspondingIndexPathForRowAtIndexPath:indexPath];
if (correspondingIndexPath.subRow == 0)
{
[_SKSTableViewDelegate tableView:tableView didSelectRowAtIndexPath:correspondingIndexPath];
} else {
[_SKSTableViewDelegate tableView:self didSelectSubRowAtIndexPath:correspondingIndexPath];
}
I'm encountering an issue, when I expand the first and second cell and select from the first expanded sub row cell, I get the second row name with the first selected sub row name. What I should get is the first name with first sub row name instead. How I can fix this issue?
Hi!
I`m trying to separate the cells for certain amount of margin but im unable to get it working. i uncommented the delegates on the library (viewForFooterInSection and heightForFooterInSection), but doesn't do anything, Which is the best way to achieve my objective?
Thank you very much.
Cheers
Is there anyone using SKSTableView and knows the subrow stuff ? I'm encountering the problem that in delegate method
func tableView(tableView: SKSTableView!, cellForSubRowAtIndexPath indexPath:
NSIndexPath!) -> UITableViewCell! {}
no matter how many number of subrows are returned, indexPath.subrow keeps giving me 0, which is the index of the first subrow. So the subrow cell can only fetch the first item of the given array.
Please help and thanks ahead.
Thanks for your nice sharing~
This project can load customize .xib from "cellForSubRowAtIndexPath" and "cellForRowAtIndexPath" ?
I'm try, but cant success.
Please try more than 100 items, such as countries and cities, it is too slow.
Many men mentioned this problem before, you'd better take it serious.
Thank you.
Please suggest some solution
I implement your newest version. I have some problems with the memory and cpu. In my example exist 1 section with 34 rows and every row has 9 or 10 subrows. I change in the debug navigator and see the follow issue:
Is there any plan?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.