JSPatch解析

JSPatch解析,第1张

JSPatch解析
 defineClass('JPViewController', {
handleBtn: function(sender) {
var tableViewCtrl = JPTableViewController.alloc().init()
self.navigationController().pushViewController_animated(tableViewCtrl, YES)
}
}) defineClass('JPTableViewController : UITableViewController <UIAlertViewDelegate>', ['data'], {
dataSource: function() {
var data = self.data();
if (data) return data;
var data = [];
for (var i = ; i < ; i ++) {
data.push("cell from js " + i);
}
self.setData(data)
return data;
},
numberOfSectionsInTableView: function(tableView) {
return ;
},
tableView_numberOfRowsInSection: function(tableView, section) {
return self.dataSource().length;
},
tableView_cellForRowAtIndexPath: function(tableView, indexPath) {
var cell = tableView.dequeueReusableCellWithIdentifier("cell")
if (!cell) {
cell = require('UITableViewCell').alloc().initWithStyle_reuseIdentifier(, "cell")
}
cell.textLabel().setText(self.dataSource()[indexPath.row()])
return cell
},
tableView_heightForRowAtIndexPath: function(tableView, indexPath) {
return
},
tableView_didSelectRowAtIndexPath: function(tableView, indexPath) {
var alertView = require('UIAlertView').alloc().initWithTitle_message_delegate_cancelButtonTitle_otherButtonTitles("Alert",self.dataSource()[indexPath.row()], self, "OK", null);
alertView.show()
},
alertView_willDismissWithButtonIndex: function(alertView, idx) {
console.log('click btn ' + alertView.buttonTitleAtIndex(idx).toJS())
}
})
;(function(){try{\ndefineClass('JPViewController', {\n  handleBtn: function(sender) {\n    var tableViewCtrl = JPTableViewController.__c(\"alloc\")().__c(\"init\")()\n    self.__c(\"navigationController\")().__c(\"pushViewController_animated\")(tableViewCtrl, YES)\n  }\n})\n\ndefineClass('JPTableViewController : UITableViewController <UIAlertViewDelegate>', ['data'], {\n  dataSource: function() {\n    var data = self.__c(\"data\")();\n    if (data) return data;\n    var data = [];\n    for (var i = 0; i < 20; i ++) {\n      data.__c(\"push\")(\"cell from js \" + i);\n    }\n    self.__c(\"setData\")(data)\n    return data;\n  },\n  numberOfSectionsInTableView: function(tableView) {\n    return 1;\n  },\n  tableView_numberOfRowsInSection: function(tableView, section) {\n    return self.__c(\"dataSource\")().length;\n  },\n  tableView_cellForRowAtIndexPath: function(tableView, indexPath) {\n    var cell = tableView.__c(\"dequeueReusableCellWithIdentifier\")(\"cell\") \n    if (!cell) {\n      cell = require('UITableViewCell').__c(\"alloc\")().__c(\"initWithStyle"

  

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/587390.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存