zoukankan      html  css  js  c++  java
  • WKInterfaceTable实例化出现的一系列

    让我摆一个姿势,缓慢伸出我的右手,面向swift,做“欲扶眼镜”状!!!

    正题

    闲话不想说了,实例化WKInterfaceTable的时候会报错,实例化代码如下:

    let row = Table.rowController(at: index) as! tableList
    

    如何避免

    正确姿势,

    func fillTable()
        {
            //set the rows
            self.Table.setNumberOfRows(tableCount, withRowType: "tableList")
            
            //necessary
            for index in 0...tableCount-1
            {
                let row = Table.rowController(at: index) as! tableList
                row.tableNumber.setText("(tableNumMsg[index])")
                row.tableMemo.setText("(tableMemoMsg[index])")
            }
        }
    

    for循环是必要的,然而最必要的是tableNumMsgtableMemoMsg 的定义,如下

    var tableNumMsg = ["","","","","","","",""]
    var tableMemoMsg = ["","","","","","","",""]
    var tableDateMsg = ["","","","","","","",""]
    
    var tableCount = 0
    

    这样也算啊,只要你不要被Xcode检测出nil就行了,啊啊啊啊啊啊啊啊啊啊啊啊啊啊,地球已经无法阻挡我了,赶紧听歌冷静一下!!!!!

    看不懂??

    请看官网说明,其实已经很明白了
    【Class·WKInterfaceTable】

  • 相关阅读:
    【计算机网络】复习集(更新中)
    滑雪 (记忆化搜索)
    橱窗布置
    复制书稿 (dp+贪心)
    8786:方格取数 (多线程dp)
    编辑距离
    8782:乘积最大
    合并石子 (区间dp+前缀和)
    6045:开餐馆
    6049:买书 (完全背包)
  • 原文地址:https://www.cnblogs.com/pualus/p/7532461.html
Copyright © 2011-2022 走看看