Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesnw/jswsimplejsontable
Populate a table using a JSON file - no datasource, delegates or UITableViewController needed
https://github.com/jamesnw/jswsimplejsontable
Last synced: 2 months ago
JSON representation
Populate a table using a JSON file - no datasource, delegates or UITableViewController needed
- Host: GitHub
- URL: https://github.com/jamesnw/jswsimplejsontable
- Owner: jamesnw
- License: mit
- Created: 2013-11-19T12:32:30.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T13:29:36.000Z (almost 2 years ago)
- Last Synced: 2024-11-27T11:39:07.918Z (2 months ago)
- Language: Objective-C
- Size: 6.84 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
JSWSimpleJSONTable
============JSWSimpleJSONTable is a subclass of UITableViewController that allows you to populate an entire table view using a JSON file, and not deal with UITableViews, delegates and data sources.
The goal is to only need
````{"text":"Cell text","image":"imageName","action":"clickedCell","height":44}````
to populate a cell, instead of editing multiple methods in a UITableViewController. To add a row, you can simply add another line in the JSON file, and not worry about updating indices throughout the file.JSWSimpleJSONTable supports customizing the following:
* text and detailText
* image
* method call when row is selected
* accessory
* height
* headersThe JSON file
=============
The JSON file is an array of dictionaries representing sections.
Each section is a dictionary with several options, and a key called "rows" that is an array of the rows in that section.
Each row is a dictionary with multiple keys.Starting Out
============
Import the JSWSimpleJSONTable class into your project.
Subclass JSWSimpleJSONTable to create your delegate, and call
`self = [super initWithStyle:style file:fileName delegate:self];`
You will put your methods and view customizations on the delegate.## Keys
### Text
````{"text":"The title text"}````
### Detail Text
````{"detailText":"The subtitle"}````### Image
````{"image":"imageFileName"}````
This is called by ````[UIImage imagedNamed:]```` so you don't need the file extension.### Methods
````{"action":"methodName"}````
You will need to add an action to your delegate's interface and implementation. You can't receive or return any objects. The above code will call the method ````-(void)methodName;````.
### Accessory
````{"accessory":"UITableViewCellAccessoryDisclosureIndicator"}````### Height
````{"height":30,}````
Default is 44## Notes
You can override any of the methods in JSWSimpleJSONTable by calling it from your delegate.