Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift:Shinobi网格中的自动文本_Swift_Datagrid_Shinobi - Fatal编程技术网

Swift:Shinobi网格中的自动文本

Swift:Shinobi网格中的自动文本,swift,datagrid,shinobi,Swift,Datagrid,Shinobi,我正在使用Shinobi数据网格,但我遇到了一个小问题,因为关于Shinobi网格的Swift示例或问题很难找到。下面是我的代码片段: var grid: ShinobiDataGrid? grid = ShinobiDataGrid(frame: self.view.bounds) grid?.frame = CGRect(x: 0, y: 120, width: (screenWidth), height: 600) theme = SDataGridTh

我正在使用Shinobi数据网格,但我遇到了一个小问题,因为关于Shinobi网格的Swift示例或问题很难找到。下面是我的代码片段:

    var grid: ShinobiDataGrid?

    grid = ShinobiDataGrid(frame: self.view.bounds)
    grid?.frame = CGRect(x: 0, y: 120, width: (screenWidth), height: 600)

    theme = SDataGridTheme()
    theme?.iOS7Arrows = true
    theme?.hideVerticalGridlines = false
    grid?.apply(theme)

    self.view.addSubview(grid!) 
    .........

   addColumn(grid!, title: "Floor", width: 100, alignment: .right, alignmentHeader: .right)

    grid?.numberOfFrozenColumns = 2
    grid?.layer.borderWidth = 1

    grid?.defaultCellStyleForHeaderRow.backgroundColor = UIColor(hex: "#1A237E")
    grid?.defaultCellStyleForHeaderRow.textColor = UIColor.white
    grid?.defaultCellStyleForHeaderRow.font.withSize(5)

    grid?.dataSource = self
    grid?.delegate = self
    ........

   func shinobiDataGrid(_ grid: ShinobiDataGrid!, prepareCellForDisplay cell: SDataGridCell!) {
    let textCell = cell as! SDataGridTextCell

     //        let textCell = cell as! SDataGridMultiLineTextCell
    var dataRow: [AnyHashable: Any]?

    dataRow = filteredDataRoomingList?[cell.coordinate.row.rowIndex] as? [AnyHashable: Any]

    textCell.sizeToFit()

    if (searchBarActive) {
        dataRow = filteredSearchDataRoomingList?[cell.coordinate.row.rowIndex] as? [AnyHashable: Any]
    }
    else {
       dataRow = filteredDataRoomingList?[cell.coordinate.row.rowIndex] as? [AnyHashable: Any]
    }

    if textCell.coordinate.column.tag == 0 {
        textCell.textField.text = (String(dataRow?["floor"] as! Int))
    //            gridMultiLine.textLabel.text = (String(dataRow?["floor"] as! Int))

           }
   }
我希望我的单元格在其内容(包装内容)中显示全文,而不是使用…截断文本

我读过,但我不知道这一块,因为它在目标C中:

SDataGridColumn *nameColumn = [[SDataGridColumn alloc] initWithTitle:@"Forename" cellType:[SDataGridMultiLineTextCell class]];
nameColumn.editable = YES;
nameColumn.width = @250;
[self.shinobiDataGrid addColumn:nameColumn];

任何建议和回答都会对我有帮助。提前感谢

我在代码下面创建了一个函数库:

func addColoumn(_ grid: ShinobiDataGrid, title: String, width: CGFloat, tag: Int, alignment: NSTextAlignment) {

    let screenSize = UIScreen.main.bounds
    let screenWidthInt = screenSize.width - CGFloat(arc4random_uniform(UInt32(screenSize.width)))

    let column = SDataGridColumn(title: title, cellType: SDataGridMultiLineTextCell.self)
    column?.width = (Int(screenWidthInt / width) as NSNumber) /*width as NSNumber!*/
    column?.tag = tag
    column?.cellStyle.textAlignment = alignment
    column?.headerCellStyle.textAlignment = alignment

    grid.addColumn(column)

}
数据源
prepareCellForDisplay
变成这样:

func shinobiDataGrid(_ grid: ShinobiDataGrid!, prepareCellForDisplay cell: SDataGridCell!) {
    let dataCell = cell as! SDataGridMultiLineTextCell
    if cell.coordinate.column.tag == 0 {

        dataCell.sizeToFit()
        dataCell.textLabel.text = "msadimfodvnuonvosvndvdivndlvsndvmvnlcvnoidn odnosdvk odkmvosdk sodimdokvs kmdsdokv "

    }
    if cell.coordinate.column.tag == 1 {

        dataCell.sizeToFit()
        dataCell.textLabel.text = "msadimfodvnuonvosvndvdivndlvsndvmvnlcvnoidn odnosdvk odkmvosdk sodimdokvs kmdsdokv sdmfdfkm sdlfkdmlf dosfod domdso os "

    }
}