Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cells are overlapping each other #237

Open
jaikalra opened this issue May 20, 2020 · 0 comments
Open

Cells are overlapping each other #237

jaikalra opened this issue May 20, 2020 · 0 comments

Comments

@jaikalra
Copy link

Expected Behavior

Actually I have spread view in table view cell. Spread view have 101 rows and 15 columns in each row. There is only one text field in each cell. Now when i run the app in iOS 12 then after scrolling 2 to 3 times the cell should be work properly.

Actual Behavior

Now when i run the app in iOS 12 then after scrolling 2 to 3 times the cells are overlapping each others.

Steps to Reproduce the Problem

IMG_3468

2.Table view cell code:
class TableCell: UITableViewCell,SpreadsheetViewDataSource {

@IBOutlet weak var furniturSpreadView: SpreadsheetView!
var rows = Int()

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
    furniturSpreadView.dataSource = self
    furniturSpreadView.bounces = false
    let BottomHeddingCell = UINib(nibName: "BottomHeddingCell", bundle: nil)
    furniturSpreadView.register(BottomHeddingCell, forCellWithReuseIdentifier: "BottomHeddingCell")
    let InputCell = UINib(nibName: "BottomInputCell", bundle: nil)
    furniturSpreadView.register(InputCell, forCellWithReuseIdentifier: "BottomInputCell")
}

override func setSelected(_ selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)
    // Configure the view for the selected state
}


//MARK:- Spread Sheet dataSource


func numberOfRows(in spreadsheetView: SpreadsheetView) -> Int {
    return rows
}

func numberOfColumns(in spreadsheetView: SpreadsheetView) -> Int {
    return 15
}

func spreadsheetView(_ spreadsheetView: SpreadsheetView, widthForColumn column: Int) -> CGFloat {
  return 170
}

func spreadsheetView(_ spreadsheetView: SpreadsheetView, heightForRow row: Int) -> CGFloat {
  return 50
}

func spreadsheetView(_ spreadsheetView: SpreadsheetView, cellForItemAt indexPath: IndexPath) -> Cell? {
    if indexPath.row == 0{
        let cell = spreadsheetView.dequeueReusableCell(withReuseIdentifier: String(describing: BottomHeddingCell.self), for: indexPath) as! BottomHeddingCell
        cell.setData(indexPath: indexPath)
        cell.clipsToBounds = true
        cell.setNeedsLayout()
        return cell
    }
    let cell = spreadsheetView.dequeueReusableCell(withReuseIdentifier: String(describing: BottomInputCell.self), for: indexPath) as! BottomInputCell
    cell.setData(indexPath: indexPath)
    cell.setNeedsLayout()
    cell.clipsToBounds = true
    return cell
}

}

  1. spread sheet cell code:
    class BottomInputCell:Cell,UIPickerViewDataSource,UIPickerViewDelegate,UITextFieldDelegate
    {

    @IBOutlet weak var txtField: JKTextField!
    let pickerView = UIPickerView()
    var itemPath = IndexPath()

    override init(frame: CGRect) {
    super.init(frame: frame)
    }

    required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    }

    func setData(indexPath:IndexPath){
    let data = currentInventoryModal.inventoryBottomSection[indexPath.row][indexPath.column]
    txtField.text = data.value
    txtField.placeholder = data.placeHolder
    txtField.tag = indexPath.row
    txtField.delegate = self
    itemPath = indexPath
    txtField.isUserInteractionEnabled = data.isEditable!
    if (data.isDropDown ?? false){
    txtField.rightImage = "dropDown"
    txtField.inputView = pickerView
    pickerView.delegate = self
    pickerView.dataSource = self
    }
    else{
    txtField.rightImage = ""
    txtField.rightView = UIView()
    txtField.inputView = .none
    }
    }

}

Specifications

  • Xcode version: 11.4
  • iOS version: 12.4
  • Dependency manager + version: 0.8.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant