What is this?
This RubyMotion project is an example of how to use nesting inside a JSON file to create a series of UITableViews. You could extend this to pull the JSON from a server somewhere to dynamically update your menu structure.
The project has 3 main files:
- The JSON data file.
When a table row that has nested data is tapped,
NestingTableViewController creates a new instance of itself (while correctly passing down the nested data) and pushes that new instance onto the navigation stack.
OK, Sounds interesting... how do I get started?
- XCode 4.5 with iOS 6 SDK.
- You must have a registered and licensed copy or RubyMotion on your computer. If you do not, you will need to purchase a license here.
- Valid Apple Developer signing certificate (if you want to install on a device).
This project has been tested using RubyMotion 1.29 and iOS SDK 6
- Clone the respoitory and
cdinto the directory
rakeand the application will build and launch the iOS simulator.
Looks like I can do a bunch of things with the JSON, huh?
Yup! There's no limit to the nesting you can do with this project! In fact, check out the very last row in the table and you'll see what I mean ;)
Explore the JSON and modify it to suit your needs. Just make sure to validate your JSON or it'll crash the app at runtime.
I'd love feedback on if you find this useful. If you find an issue, please fork fix, fix it, and submit a pull request (or submit an issue through github).
Inspiration to do this came from @diemer's JSONTableView project. I simply wanted more control over how the data was presented and needed nesting. Check out his project for an example of loading the data from a server.
Thanks to Laurent Sansonetti for creating RubyMotion!