zoukankan      html  css  js  c++  java
  • JSPatch解析

     1 defineClass('JPViewController', {
     2   handleBtn: function(sender) {
     3     var tableViewCtrl = JPTableViewController.alloc().init()
     4     self.navigationController().pushViewController_animated(tableViewCtrl, YES)
     5   }
     6 })
     7 
     8 defineClass('JPTableViewController : UITableViewController <UIAlertViewDelegate>', ['data'], {
     9   dataSource: function() {
    10     var data = self.data();
    11     if (data) return data;
    12     var data = [];
    13     for (var i = 0; i < 20; i ++) {
    14       data.push("cell from js " + i);
    15     }
    16     self.setData(data)
    17     return data;
    18   },
    19   numberOfSectionsInTableView: function(tableView) {
    20     return 1;
    21   },
    22   tableView_numberOfRowsInSection: function(tableView, section) {
    23     return self.dataSource().length;
    24   },
    25   tableView_cellForRowAtIndexPath: function(tableView, indexPath) {
    26     var cell = tableView.dequeueReusableCellWithIdentifier("cell") 
    27     if (!cell) {
    28       cell = require('UITableViewCell').alloc().initWithStyle_reuseIdentifier(0, "cell")
    29     }
    30     cell.textLabel().setText(self.dataSource()[indexPath.row()])
    31     return cell
    32   },
    33   tableView_heightForRowAtIndexPath: function(tableView, indexPath) {
    34     return 60
    35   },
    36   tableView_didSelectRowAtIndexPath: function(tableView, indexPath) {
    37      var alertView = require('UIAlertView').alloc().initWithTitle_message_delegate_cancelButtonTitle_otherButtonTitles("Alert",self.dataSource()[indexPath.row()], self, "OK",  null);
    38      alertView.show()
    39   },
    40   alertView_willDismissWithButtonIndex: function(alertView, idx) {
    41     console.log('click btn ' + alertView.buttonTitleAtIndex(idx).toJS())
    42   }
    43 })
    ;(function(){try{
    defineClass('JPViewController', {
      handleBtn: function(sender) {
        var tableViewCtrl = JPTableViewController.__c("alloc")().__c("init")()
        self.__c("navigationController")().__c("pushViewController_animated")(tableViewCtrl, YES)
      }
    })
    
    defineClass('JPTableViewController : UITableViewController <UIAlertViewDelegate>', ['data'], {
      dataSource: function() {
        var data = self.__c("data")();
        if (data) return data;
        var data = [];
        for (var i = 0; i < 20; i ++) {
          data.__c("push")("cell from js " + i);
        }
        self.__c("setData")(data)
        return data;
      },
      numberOfSectionsInTableView: function(tableView) {
        return 1;
      },
      tableView_numberOfRowsInSection: function(tableView, section) {
        return self.__c("dataSource")().length;
      },
      tableView_cellForRowAtIndexPath: function(tableView, indexPath) {
        var cell = tableView.__c("dequeueReusableCellWithIdentifier")("cell") 
        if (!cell) {
          cell = require('UITableViewCell').__c("alloc")().__c("initWithStyle"
    

      

  • 相关阅读:
    kicad 基本操作
    RedHat centos中的上传下推脚本
    使用Node.js爬虫存储MySQL数据库
    解决vue和vue-template-compiler版本不同报错的问题
    Vue组件通信(父子组件通信)-学习笔记
    git 简单操作
    错误解决:redis.exceptions.ResponseError: unknown command 'SENTINEL'
    nginx做泛域名解析的域名的正则判断
    postman对字符串进行base64编码方法和变量的使用
    pymysql报错OperationalError: (2013, 'Lost connection to MySQL server during query')
  • 原文地址:https://www.cnblogs.com/studyNT/p/7224605.html
Copyright © 2011-2022 走看看