タップしたときに単一のtableveiewcellの高さを取得したい。私は周りを見ていますが解決策はありません。タップしたときに単一のtableviewcellの高さを取得しますか?
任意の提案??
ありがとうございました!
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
}
:
タップしたときに単一のtableveiewcellの高さを取得したい。私は周りを見ていますが解決策はありません。タップしたときに単一のtableviewcellの高さを取得しますか?
任意の提案??
ありがとうございました!
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
}
:
使用デリゲートメソッドで
その後、タップされたセルを見つけるために使用することができますそのメソッドの内部セルは:
let cell = tableView.cellForRowAtIndexPath(indexPath)
次に、セルのフレーム上のプロパティとして高さを取得できるはずです。
let height = cell.frame.height
あなたは、デリゲートメソッドが
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
indexPath取得するセルの高さ
... –
にfuncのtableView(のtableView:のUITableView、didSelectRowAtIndexPath indexPath:NSIndexPath) –
あなたは
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath)
print(cell?.frame.height)
}
貴重な情報をお寄せいただきありがとうございます。それも働いた。あなたの答えも正しいです。 – niks290192
あなたの歓迎:) – Sahil
をUITableViewDelegateできねえ、あなたはTableViewDelegates
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
let cell = tableView.cellForRowAtIndexPath(indexPath)
print(cell?.frame.height)
}
あなたが行を選択すると、このメソッドは
let cell = tableView.cellForRowAtIndexPath(indexPath)
と呼ばれる使用することができます - >セルタップセルが含まれているがinfo like(heig HT、幅、content..etc) - >あなたはあなたが現在のセルの幅をしたい場合は、
cell?.frame.width
を書くことができ、同じ
cell?.frame.height
を書くので、あなたが高さを必要とするようにしたいセルの情報を使用
あなたのための参考になった場合、それが迅速で申し訳ありません
おかげ
貴重な情報をJustJasperに感謝します。出来た。 – niks290192
あなたは大歓迎です:) –