https://github.com/superbil/hcategorymodel
Managing hierarchical data in iOS
https://github.com/superbil/hcategorymodel
Last synced: about 1 year ago
JSON representation
Managing hierarchical data in iOS
- Host: GitHub
- URL: https://github.com/superbil/hcategorymodel
- Owner: Superbil
- License: mit
- Created: 2013-09-08T16:04:48.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-11-04T09:07:05.000Z (over 12 years ago)
- Last Synced: 2025-04-13T05:56:38.338Z (about 1 year ago)
- Language: Objective-C
- Size: 422 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## HCategoryModel ##
Managing hierarchical data in iOS. This is impelement [managing hierachial data](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/) in iOS
## Need library ##
* sqlite
* FMDB
## Use age ##
more example in HCategoryModelTests.m
### open data path
self.categoryModel = [[HCategoryModel alloc] initWithDatabasePath:path];
### insert first category
NSInteger insertCategoryID = [self.categoryModel insertCategoryWithName:@"firstNode" atCategoryID:kRootCategory];
### update category
NSString *newName = @"this is a new name";
HCategory *vcf = [self.categoryModel categoryWithCategoryID:2];
vcf.name = newName;
// check newVCF
HCategory *newVcf = [self.categoryModel categoryWithCategoryID:2];
### move category
HCategory *rootCategory = [self.categoryModel categoryWithCategoryID:kRootCategory];
HCategory *moveCategory = [self.categoryModel categoryWithCategoryID:3];
[self.categoryModel moveCategory:moveCategory toCategory:rootCategory];
### list all category from root category
NSArray *resultCategories = [self.categoryModel listCategoryWithCategoryID:kRootCategory];
for (HCategory *vcf in resultCategories) {
// .. each vcf
}
## License ##
MIT