从自定义tablecell重新加载时,Collectionview重新加载不起作用。
我在一个collectionview单元格中放了一个下拉列表。这个下拉列表也无法正常工作。
以下是代码:
class HotelAvailableRoomsTVCell: UITableViewCell {
@IBOutlet weak var collectionView: UICollectionView!
//MARK: Life cycle
override func awakeFromNib() {
super.awakeFromNib()
let nib = UINib.init(nibName: "AvailableRoomCVCell", bundle: nil)
collectionView.register(nib, forCellWithReuseIdentifier: "AvailableRoomCVCell")
collectionView.delegate = self
collectionView.dataSource = self
// Initialization code
}
func initCellWithData(roomJSON:JSON,indexPath:IndexPath,isSingle:Bool) {
DispatchQueue.main.async {
self.collectionView.reloadData()
}
}
}
在viewController中:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "HotelAvailableRoomsTVCell", for: indexPath) as! HotelAvailableRoomsTVCell
cell.delegate = self
cell.initCellWithData(roomJSON: (json)!, indexPath: indexPath as IndexPath, isSingle: true)
return cell;
}
屏幕是: 我使用了具有动态数量的单元格的tableview作为collectionview。此集合视图包含一个下拉列表,如图所示
答案 0 :(得分:0)
首先,做到这一点&检查
Selection
你也可以这样做,(已由我及其工作完成),
通过在Option Explicit
Private Sub OptionButton1_Click()
Dim sht As Worksheet
Set sht = ThisWorkbook.ActiveSheet ' instead I recommend to reference a worksheet
' by name: ThisWorkbook.Worksheets("SheetName")
Dim Shape1 As Shape
Set Shape1 = sht.Shapes.AddShape(msoShapeRectangle, 285, 74.25, 112.5, 108.75)
Shape1.OLEFormat.Object.ShapeRange.Line.Visible = msoFalse
With Shape1.OLEFormat.Object.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent6
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.6000000238
.Transparency = 0
.Solid
End With
Dim Shape2 As Shape
Set Shape2 = sht.Shapes.AddShape(msoShapeRectangle, 285.75, 74.25, 111.75, 21.75)
Shape2.OLEFormat.Object.ShapeRange.Line.Visible = msoFalse
With Shape2.OLEFormat.Object.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent6
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.400000006
.Transparency = 0
.Solid
End With
sht.Shapes.Range(Array(Shape1.Name, Shape2.Name)).Group
End Sub
中创建var来传递数据。
class HotelAvailableRoomsTVCell: UITableViewCell, UICollectionViewDelegate,UICollectionViewDataSource
在HotelAvailableRoomsTVCell
var collectionData : [String : Any] = []