我正在尝试在 App 中编写一个检查,在用户在第一个视图上输入信息后,视图更改为会议的 tableView。目前我面临两个问题;第一个问题是单元格滚动过标题并在状态栏下方,我该如何解决这个问题?第二个问题是向下滚动会拉动标题,有没有办法改变它?
我在网上看了一点,有人建议使用导航控制器并在其中放置一个 UItable 视图。我试图避免 StoryBoard,所以我想知道如何使用代码来做到这一点。
到目前为止,这是我的代码
class MeetingsViewController: UITableViewController, UITableViewDelegate, {
@IBOutlet var meetingsView : UITableView
var meetings = []
override func viewDidLoad() {
super.viewDidLoad()
title = "Meetings"
![enter image description here][1]tableView.registerClass(MeetingCell.self, forCellReuseIdentifier: "cell")
let edgeInsets = UIEdgeInsetsMake(20, 0, 0, 0)
self.tableView.contentInset = edgeInsets
self.tableView.scrollIndicatorInsets = edgeInsets
}
override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
return 10
}
override func tableView(tableView: UITableView!, titleForHeaderInSection section: Int) -> String!
{
return "Meetings"
}
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell? {
let cell = tableView!.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as MeetingCell
if let path = indexPath {
//let entry = news[path.row] as NSDictionary
cell.text = "Meeting Name "
cell.detailTextLabel.text = "Time "
}
return cell
}
}