2016-04-14 2 views

答えて

3

使用デリゲートメソッドで

その後、タップされたセルを見つけるために使用することができますそのメソッドの内部セルは:

let cell = tableView.cellForRowAtIndexPath(indexPath) 

次に、セルのフレーム上のプロパティとして高さを取得できるはずです。

let height = cell.frame.height 
+0

貴重な情報をJustJasperに感謝します。出来た。 – niks290192

+0

あなたは大歓迎です:) –

0

あなたは、デリゲートメソッドが

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; 

indexPath取得するセルの高さ

+0

... –

+0

にfuncのtableView(のtableView:のUITableView、didSelectRowAtIndexPath indexPath:NSIndexPath) –

1

あなたは

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 
    let cell = tableView.cellForRowAtIndexPath(indexPath) 
print(cell?.frame.height) 

} 
+0

貴重な情報をお寄せいただきありがとうございます。それも働いた。あなたの答えも正しいです。 – niks290192

+0

あなたの歓迎:) – Sahil

0

を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 

を書くので、あなたが高さを必要とするようにしたいセルの情報を使用

あなたのための参考になった場合、それが迅速で申し訳ありません

おかげ

関連する問題