2
如何將我的第一個tableview單元格放置到其餘單元格高度的兩倍?如何使每個tableview單元格的大小不同?
這是我的tableview代碼:
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return posts.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")
let label1 = cell?.viewWithTag(1) as! UILabel
label1.text = posts[indexPath.row].title
let imageView = cell?.viewWithTag(2) as! UIImageView
let post = self.posts[indexPath.row];
imageView.sd_setImage(with: URL(string: post.downloadURL), placeholderImage: UIImage(named: "placeholder"))
return cell!
}
感謝它的作品!你是否也知道如何讓每個細胞再次成爲兩倍的細胞? – Riccardo
是的,你可以改變你的邏輯。如果indexPath.row%5 == 0 –
謝謝!我怎樣才能讓標題移動,所以它不會被切斷? – Riccardo