motion-table 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -41,7 +41,7 @@ class MyController < UITableViewController
41
41
  {
42
42
  title: "Your Account",
43
43
  cells: [
44
- { title: "Edit Profile", action: :edit_profile },
44
+ { title: "Edit Profile", action: :edit_profile},
45
45
  { title: "Log Out", action: :log_out },
46
46
  ]
47
47
  },
@@ -69,6 +69,46 @@ end
69
69
 
70
70
  [<img src="http://i.imgur.com/lCIU6.png">]
71
71
 
72
+ ```ruby
73
+ class MyController < UITableViewController
74
+ include MotionTable::PlainTable
75
+
76
+ def viewDidLoad
77
+ super
78
+ self.title = "Settings"
79
+
80
+ @plain_table_view_data ||= [
81
+ {
82
+ title: "Friends",
83
+ cells: [
84
+ { title: "Friend 1", action: :view_friend, arguments: 1},
85
+ ]
86
+ },
87
+ {
88
+ title: "Contacts",
89
+ cells: [
90
+ { title: "Foo", action: :something_here, arguments: { bar: "baz", this: "that"} },
91
+ ]
92
+ }
93
+ ]
94
+
95
+ self.view = self.createTableViewFromData(@plain_table_view_data)
96
+ end
97
+
98
+ def view_friend(id)
99
+ # load this friend based on id
100
+ end
101
+
102
+ def somethind_here(args)
103
+ # You can pass any data structure into :arguments, it is just passed as an argument to your implementation
104
+ # You have to handle it. Like so:
105
+ args.each do |k, v|
106
+ puts "Argument passed: #{v}""
107
+ end
108
+ end
109
+ end
110
+ ```
111
+
72
112
  ## Contributing
73
113
 
74
114
  1. Fork it
@@ -46,7 +46,11 @@ module MotionTable
46
46
  cell = cellAtSectionAndIndex(indexPath.section, indexPath.row)
47
47
  tableView.deselectRowAtIndexPath(indexPath, animated: true);
48
48
  if self.respond_to?(cell[:action])
49
- self.send(cell[:action])
49
+ if cell[:arguments]
50
+ self.send(cell[:action], cell[:arguments])
51
+ else
52
+ self.send(cell[:action], cell[:arguments])
53
+ end
50
54
  else
51
55
  MotionTable::Console.log(self, actionNotImplemented: cell[:action])
52
56
  end
@@ -1,3 +1,3 @@
1
1
  module MotionTable
2
- VERSION = "0.1.3" unless defined?(MotionTable::VERSION)
2
+ VERSION = "0.1.4" unless defined?(MotionTable::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-27 00:00:00.000000000 Z
12
+ date: 2012-08-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: MotionTable is a RubyMotion gem that makes it easy to handle UITableViews
15
15
  from a UITableViewController.