Browse files

improve README

  • Loading branch information...
1 parent 3c39b20 commit ab9187d0d13013d280aa81c8029c1a116d1cca0c @mmin18 committed Oct 22, 2013
Showing with 32 additions and 1 deletion.
  1. +32 −1 README.md
View
33 README.md
@@ -9,4 +9,35 @@ The patch is a zip file contains patch.lua and other lua codes. The sample code
The sample iOS project loads the patch from a url (which you probably want to change in AppDelegate.m) before launch.
-The Original.png and Patched.png shows the difference.
+##### The original version in obj-c:
+
+![Original](https://raw.github.com/mmin18/Create-a-More-Flexible-App/master/WaxOriginal.png)
+
+ @implementation MainViewController
+
+ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return 10;
+ }
+
+ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];
+ cell.textLabel.text = [NSString stringWithFormat:@"%d", indexPath.row + 1];
+ return cell;
+ }
+
+ @end
+
+##### The pacthed version with lua:
+
+![Patched](https://raw.github.com/mmin18/Create-a-More-Flexible-App/master/WaxPatched.png)
+
+ waxClass{"MainViewController", UITableViewController}
+
+ function tableView_cellForRowAtIndexPath(self, tableView, indexPath)
+ local cell = self:ORIGtableView_cellForRowAtIndexPath(tableView, indexPath) -- The original method is retained with 'ORIG' prefix
+ cell:textLabel():setText("" .. (10 - indexPath:row()))
+ cell:detailTextLabel():setText("http://github.com/mmin18")
+ cell:textLabel():setTextColor(UIColor:redColor())
+ return cell
+ end
+

0 comments on commit ab9187d

Please sign in to comment.