【发布时间】:2016-12-16 21:24:15
【问题描述】:
我正在尝试在情节提要中创建个人资料 UI,但遇到了一个问题。我需要像在 Twitter 应用程序配置文件中一样创建“标题”,但我不知道该怎么做。我试图在原型单元格中放置一个 imageView,但它开始与整个 tableView 一起滚动(例如,当我试图向上滚动时,顶部有一个空白区域)。
Click here to see necessary UI
任何建议将不胜感激!
!!!解决方案
我找到了最适合我的解决方案。我远离 xCode,所以我尝试用 Sketch 来说明它。
您需要在 ViewController 中设置一个 containerView。将在您的 containerView 中嵌入 tableView。现在,您需要在 ViewController 中使用 imageView 的高度设置您的第一个原型单元格。然后,您所需要的只是几行代码:)
let cell = tableView.dequeueReusableCellWithIdentifier("IDOfYourFirstPrototypeCell") as UITableViewCell!
cell.backgroundColor = UIColor.clearColor()
return cell
在你的 viewDidLoad 函数中:
tableView.backgroundColor = UIColor.clearColor()
另外,如果我没记错的话,你需要移除 ContainerView 的背景。
在你的 ViewController 的 viewDidLoad 函数中:
containerView.backgroundColor = UIColor.clearColor()
对不起,如果我的帖子中有一些语法错误:)
【问题讨论】:
标签: swift uitableview storyboard