我對工作如下: Screenshot點擊時。調整的tableView全屏
基本上它是一個UIImageView的另一個的UIImageView以內的頂部(在屏幕的60%),而這需要的40%的UITableView屏幕
和代碼(見下文):
我想實現是調整時,我customCell被點擊的UITableView的全屏的細胞和unsize它是未點擊時的原始狀態。
有什麼辦法可以使這項工作? 在此先感謝。
//Label outlets
@IBOutlet weak var tableView: UITableView!
var selectedIndexPath : IndexPath? = nil
override func viewDidLoad() {
super.viewDidLoad()
//MARK Start of CustomViewCell Code
tableView.register(UINib(nibName: "CustomViewCell", bundle: nil), forCellReuseIdentifier: "Cell")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! CustomViewCell
cell.clipsToBounds = true
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let index = indexPath
if selectedIndexPath != nil {
if index == selectedIndexPath {
return 667
} else {
return 62
}
} else {
return 62}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch selectedIndexPath {
case nil:
selectedIndexPath = indexPath
default:
if selectedIndexPath! == indexPath {
selectedIndexPath = nil
} else {
selectedIndexPath = indexPath
}
}
tableView.reloadRows(at: [indexPath], with: .automatic)
}
//MARK End of CustomViewCell Code
什麼是你'tableViewCell'的,你會全屏顯示的內容?它有一個'imageView'? – Santosh
沒有@Santosh'標籤'和'textView' – j0h4nf