1
我想在應用約束後在我的container1的中間應用一行問題是中間行在每行中應用兩次。似乎layOutSubviews方法正在爲每行執行兩次,我很困惑爲什麼。?約束在每個單元上之前和之後被執行在我的自定義細胞TableViewCell被調用兩次
override func layoutSubviews() {
super.layoutSubviews()
println(self.container1?.frame.height)
var middleLine1:UIView = UIView(frame: CGRectMake(self.container1!.frame.origin.x, self.container1!.frame.origin.y+(self.container1!.frame.height/2), 10, 1))
middleLine1.backgroundColor = UIColor(rgba: "#cccac8")
self.addSubview(middleLine1)
}
中的println
layOutSubviews方法?
的tableView委託Methdos
func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("BracketCell") as? BracketCell
cell?.selectionStyle = UITableViewCellSelectionStyle.None
return cell!
}