2
我想创建一个屏幕下面持有一些UIElements
和UITableView
。 为了让所有东西都可以滚动,我实现了一个UITableView
和一个tableHeaderView
,其中包含UIElements
。UITableView与HeaderView不滚动
现在视图不能正确滚动以显示全部UITableViewCells
。
这是步骤,到目前为止,我还跟着:通过编程创建UIView
- ,它的
Subviews
- 设置自定义
UIView
到table.tableHeaderView
- 加载
data
。
我错过了什么?
编辑:代码的三个步骤
1,2。
让边界= UIScreen.mainScreen()。边界
imageSliderVC = TNImageSliderViewController()
imageSliderVC.view.frame = CGRectMake(0, 0, bounds.width, bounds.width)
layerView = UIView(frame: CGRectMake(0, 0, bounds.width, bounds.width))
layerView.alpha = 0.25
layerView.backgroundColor = UIColor.blackColor()
noButton = constructNopeButton()
yesButton = constructLikedButton()
buttonOptionsApply()
nameLbl = UILabel(frame: CGRectMake(20, layerView.frame.maxY + 20, bounds.width-40, 20))
nameLbl.makeNameLabelFormat()
hashtagLbl = UILabel(frame: CGRectMake(20, nameLbl.frame.maxY + 5, bounds.width-40, layerView.frame.width/3.66))
hashtagLbl.makeHashtagFormat()
seperatorLbl = UILabel(frame: CGRectMake(20, hashtagLbl.frame.maxY + 15, bounds.width-40, 1))
seperatorLbl.backgroundColor = UIColorFromRGB(0x9B9B9B)
groupsLbl = UILabel(frame: CGRectMake(20, seperatorLbl.frame.maxY + 15, 30, 20))
groupsLbl.text = "Groups:"
groupsLbl.makeNameLabelFormat()
groupsLbl.sizeToFit()
groupsCountLbl = UILabel(frame: CGRectMake(groupsLbl.frame.maxX + 5, seperatorLbl.frame.maxY + 15 , 40, 20))
groupsCountLbl.sizeToFit()
let myView = UIView(frame: CGRectMake(0,0,bounds.width, groupsCountLbl.frame.maxY + 10))
myView.addSubview(imageSliderVC.view)
myView.addSubview(layerView)
myView.addSubview(noButton)
myView.addSubview(yesButton)
myView.addSubview(nameLbl)
myView.addSubview(hashtagLbl)
myView.addSubview(seperatorLbl)
myView.addSubview(groupsLbl)
myView.addSubview(groupsCountLbl)
table.tableHeaderView = myView
你能证明你的代码对于那些3个步骤? – penatheboss
我编辑了一切。我不认为数据加载是必要的,虽然 – JVS
你确定你的表的scrollEnabled设置为true? – penatheboss