Swift初心者です.
質問させて頂きます。
TableViewCellの高さを動的する方法は把握しているのですが、
tableViewの高さを動的(可変)にする方法を教えて頂けませんでしょうか?
キャプチャー画像を添付させて頂きます。
tableviewが二つあり、
それぞれのtableviewの高さを可変にする方法を教えて頂けませんでしょうか?
また、ソースコードを下記に記載させて頂きます。
ViewController.swift
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var tableView01: UITableView! override func viewDidLoad() { super.viewDidLoad() } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if tableView.tag == 1 { return 4 } return 5 } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! table01 if tableView.tag == 1 { cell.label01.text = "テスト01" } else if tableView.tag == 2 { cell.label02.text = "テスト02" } return cell } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() }
}
table01.swift
import UIKit
class table01: UITableViewCell {
@IBOutlet weak var label01: UILabel! @IBOutlet weak var label02: UILabel!
}
恐れ入りますが、
どうかご教授お願い致します。
何を基準に動的に変えたいのでしょうか? 例えば、画面のサイズでしょうか?
あなたの回答
tips
プレビュー