获取.xib高度以在heightForRowAtIndexPath函数中使用它 [英] Get .xib height to use it in the heightForRowAtIndexPath function
问题描述
我创建了一个自定义.xib,其中包含一个TableViewCell,该TableViewCell包含一个 UIImageView
和 UILabel
.
I have created a custom .xib that contains a TableViewCell that contains a UIImageView
And UILabel
.
我想知道.xib文件中的TableViewCell高度,而不是在 heightForRowAtIndexPath
函数中手动设置它.
I want to know TableViewCell height in the .xib file, not to set it manually in heightForRowAtIndexPath
function.
当我在.xib文件中手动更改它时,是否还有 UIImage
的属性具有TableViewCell的高度?
Also is there a property of UIImage
to have the height of the TableViewCell when i change it by hand in the .xib file?
推荐答案
UITableViewCell实际上是一个UIView,因此当您从xib加载它时,frame属性可以帮助您:
UITableViewCell is actually a UIView, so when you load it from xib the frame property can help you:
cell.frame.size.height
cell.frame.size.height
这篇关于获取.xib高度以在heightForRowAtIndexPath函数中使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!