augustyniak / ratreeview Goto Github PK
View Code? Open in Web Editor NEWLibrary providing easy-to-use interface for displaying tree structures on iOS and tvOS.
License: MIT License
Library providing easy-to-use interface for displaying tree structures on iOS and tvOS.
License: MIT License
122: self.rowsExpandingAnimation = RATreeViewRowAnimationTop;
123: self.rowsExpandingAnimation = RATreeViewRowAnimationBottom;
should be
122: self.rowsExpandingAnimation = RATreeViewRowAnimationTop;
123: self.rowsCollapsingAnimation = RATreeViewRowAnimationBottom;
Thank you for making such a wonderful control. When I add an image to my tableview cell, how can I achieve indentation of the image as well.
Hi thanks for developing this great api.
I want to feed RATreeView with items which I get from sqlite db with core data.
FetchedResultsController needs sectionIndex. which I can't get from data source method.
do you know how can I provide sectionIndex?
would you mind provide a sample of treeView using coreData?
我用了你的ratreeview做的cell,然后用的sdwebimage加载图片,发现滑动cell 的时候内存泄露太严重了。耽误了我的项目进度,丫的赔我钱吧!
而且滑动的时候还卡,耽误我项目进度,丫的赔我钱!
In my Application I am using the treeDepthLevel property of RATreeNodeInfo to get the key for the next level children But to my surprise that property is always equal to zero instead of the current node level
Is is also possible to hide unused cell? In the old tableview, I could set the footer height to some very small number, say, 0.01f and then create an empty uiview as the footer. Any plan to implement similar functionality?
Hi!
Thanks for such a great control. This is what i was looking for. Just wanted to ask, how i can reorder (drag/drop) cells. I couldn't find any delegate for that. Is it possible?
Thank you for such wonderful control.
This is not an issue, I was wondering is it possible to have UITableViewCell which was expanded, I checked following delegate method is being called whenever any tree is being expanded but was not able to understand how to access particular UITableViewCell from this method.
I want to add open/closed state using image to inform user regarding cell is expanded.
e.g.
tableViewCell.image = @"Opened" or tableViewCell.image = @"Closed"
Can you please assist ?
Thanks,
just use the demo, when call
but the delegate of
won't be called.
I found that this delegate will be called in
in RATreeView+TableViewDelegate.
pod search RATreeView
[!] Unable to find a pod with name matching `RATreeView'
Is there a way to expand all the nested cell with one call ?
It was so easy to use RATreeView in my app and it looks great. Thank you for such a useful bit of code.
The earlier closed issue doesn't apply anymore as there is no public visibility of the tableview property in RATreeView.
There seems to be no way of deleting rows. The comment in the header file suggests there is but there is no selector.
I try to call the expandRowForItem:
, I get a crash that table view try to insert rows.
I think it is that the row is expanded, and I expand it again!
I can not access the treeNode
for the item
, so I can not get the expand status.
I hope you can add some code like this:
- (void)expandRowForItem:(id)item withRowAnimation:(RATreeViewRowAnimation)animation
{
NSInteger index = [self.treeNodeCollectionController indexForItem:item];
RATreeNode *treeNode = [self.treeNodeCollectionController treeNodeForIndex:index];
+ if (treeNode.expanded) {
+ return;
+ }
[self expandCellForTreeNode:treeNode withRowAnimation:animation];
}
When the labels get too long, they get cut off with ellipses "...", but if it's necessary to see the whole label, wrapping texts could be useful. I have tried to implement it to no avail. Do you have some suggestions as to a solution for this?
In RATreeNode
:
@property (strong, nonatomic, readonly) RATreeNodeInfo *treeNodeInfo;
Should be:
@property (weak, nonatomic, readonly) RATreeNodeInfo *treeNodeInfo;
There's a retain cycle here and it's causing whatever model you are using for your tree to never get dealloced.
Thanks!
Hi,
First I would like to say thanks for the great work this is a really awesome library to use.
I've started implementing your RATreeView and have come across a situation where I need to handle a tap gesture on a custom View that I use as the cell contentView and all works fine.
I however run into an issue when I handle the tap gesture on a button in the view as I am able to get the UITableViewCell which it originated from but need to then get access to the corresponding "item" in the RATreeView.
I basically need a method with signature: - (id) itemForCell: (UITableViewCell *) cell
.
I am writing to you for the following reasons:
Regards
Rory Beling
In RATreeView+TableViewDelegate.m:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
The line:
id item = [self.delegate treeView:self willSelectRowForItem:treeNode treeNodeInfo:[treeNode treeNodeInfo]];
Should probably be:
id item = [self.delegate treeView:self willSelectRowForItem:treeNode.item treeNodeInfo:[treeNode treeNodeInfo]];
Unless my two weeks of Objective C programming is leading me astray, which it may be. However, making this change fixed my issues with handling this event.
The view should probably have indexPathForCell and/or itemForCell added to it. This would make it easier to get the associated item on a touch event, say from a button added to the cell. And there are many times when an item is available and a cell is needed.
Here can not add more dynamic data, and display
Hi,
i'm facing a problem, when i expand a cell the treeview automatically scrolls to top. I can't disable it using scrollsToTop or alwaysBounceVertical properties of tableview.
How can i disable this?
Thanks!
I have this RATreeView inside a collection view cell.
When the table view cell expands I want to increase the collection view cell height.
But how can i get the height of the tableView after expanding so that i can expand the collection view cell to same amount.
In RATreeView i can only access contentSize which is not giving proper results.
Thanks
how to implement to expand the father first child menu item by default when i click father menu item ?
Is there anybody know that?
Does it currently support Grouped style tableview? I've set the style to RATreeViewStyleGrouped, but all my data are in the same section.
BTW, thanks for the great work 👍
Thanks for creating this great component!
One issue i have is when i try to use the expandRowForItem this only works for items in the highest leaf, not with children :( Any suggestions to fix this?
In my project i want to have 4 level tree so i used this source code but after adding 4 level tree my app crash when collapsing a cell with animation. following is the crash report found in my project
"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cell animation stop fraction must be greater than start fraction' "
And My Tree is like following
_First_level_item 1
_______ Second_level_item 1
_____________Third_level_item 1
_____________Third_level_item 2
_____________Third_level_item 3
_____________Third_level_item 4
___________________Fourth_level_item 1
___________________Fourth_level_item 2
__________________*Fourth_level_item 3
// Creating Table View Cells
- (void)registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(5_0);
- (void)registerClass:(Class)cellClass forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);
simple implementation
- (void)registerClass:(Class)cellClass forCellReuseIdentifier:(NSString *)identifier
{
[self.tableView registerClass:cellClass forCellReuseIdentifier:identifier];
}
hi
reloadData method not work.
and after that numberOfChildrenOfItem of datasource not call.
for example add this code in end of viewDidLoad of your Demo Project
walls = [RADataObject dataObjectWithName:@"Walls1" children:nil];
self.data = [NSArray arrayWithObjects:phone, computer, car, bike, house, flats, motorbike, drinks, food, sweets, watches, walls, nil];
[treeView reloadData];
you will see still Wall shown as last object of table view instead of Walls1
If I implement - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ in the tableview delegate, the method is never called. Any idea how to get it called?
I am implement RATreeView in my Project . I create custom cell in which button for first level.So my issue is how to find which button is click from firstlevel in RATreeview . In tableview we have set tag of button and get index of button but how to done in RAtreeView
There is a issue that reloadData makes all sections closed (collapsed).
It would be nice to keep the open and close states the same.
Regards,
Yunhe
RATreeVIew contains
that crash on iOS6
Hi, is it possible that with recent changes we have lost this call? I remember this was called before but not anymore, can you have a look? Thanks!
When the user taps on a cell and it expands. The method cellForItem is called again but this is done before the expanding was completed. Therefore the expanded property of treeNodeInfo is always NO. This makes it impossible to return another TableViewCell for expanded state.
In RATree view reload treeview is not working
hi! @Augustyniak
Thank you very much for your open source library, but now I have a small problem: how can I top in the treeView embedded a UISearchBar?
Jack
The separator line of the cell above the tapped cell gets hidden.
Scenario: Tap on second cell of levelDepth 0, It open ups levelDepth1 for the same cell.
Tap again on the same cell (i.e levelDepth 0) It will close the levelDepth1 for the cell
Now observe the separator line of the previous cell. It is disappeared
I have tried many combination but couldn't get working one
RATreeView *treeView = [[RATreeView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
RATreeView *treeView = [[RATreeView alloc] initWithFrame:CGRectMake(0, 0, 320, 300) style:RATreeViewStylePlain];
both not working, then I have created xib with view, assign RATreeView, connect with code as IBOutlet and still not working for custom sizes
All of this examples not working if you wanna smaller size for view, is there any fix for this or I making something wrong???
Every time they are in full screen mode :(
Thx
My application will know if a cell is going to show the children based on the RAtreeNodeInfo value so it will be helpful if i get that parameter too in the above datasource
If I have a tree like this:
John
Guitar
Yoko Ono
Paul
George
Ringo
.. when I select Ringo, I would like it to turn into this:
John
Paul
George
Drums
Barbara Bach
Ringo
So how would I close all top level items when another top level item is selected?
If yes, could you give an example with it?
Thanks!
Hi,
First of all, thanks for you lib.
I just used it to make a treeview, and every things working fine.
But i'd like now to be able to select an item (depth doesn't matter), I saw that there is a interested function which is the Delete button appearing when we slide Right > Left.
Is there a way to catch the button action ?
I'm a beginner in iOS programming and objective-C (started yesterday).
Thanks in advance,
how to show cell highlight
I tried to use [self.treeView.tableView deleteRowsForIndexPaths:withRowAnimation:]
, but always crash:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (9) must be equal to the number of rows contained in that section before the update (9), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
There is no enumeration that corresponds to UITableViewRowAnimationFade enumeration in RATreeViewRowAnimation. I had to add it and make related conversion myself.
What's the reason of specifically excluding fade animation from animation alternatives?
Also I have a more general question. What's the reason behind defining your own enumerations for almost all enumerations that UITableView defines? I didn't see any different usage for them, you're requesting your own enumeration key, then convert it to UITableView's corresponding enumerations that everybody is familiar with.
I think it adds redundancy to the component and decrease simplicity.
What you think about that?
First off, thank you so much for offering this project code on here. It's exactly what I was looking for.
I'm sure it's just me but I'm having issues trying to dynamically change the cell between a default style to my own custom style when the user expands a parent cell.
I've created my own subclasses uitableviewcell. I can get it to change between default style cells but I can't find a way to init my custom one and change the cell in the "willexpandrow" method.
Can you offer any help or is this not possible?
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.