bannzai / bannzai/SpreadsheetView
Cells are overlapping each other
- Dominant language
- HTML
- Stars
- 3.5k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
## 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
1.

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
}
}
2. 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.