2
最初のテーブルビューセルを次のセルの残りの部分の高さの2倍にするにはどうすればよいですか?どのように各テーブルビューのセルを異なるサイズにするか?
これは私のテーブルビューのコードです:
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!
}
感謝を使用する必要があります!また、5回ごとに5倍のセルを2倍にする方法も分かっていますか? – Riccardo
はい、このようなロジックを変更することができます。 if indexPath.row%5 == 0 –
ありがとう!どのようにタイトルを手に入れてもらうと、それは途切れることはありませんか? – Riccardo