For some reason, when using size classes in xcode 6, I am getting incorrect widths for subviews in my cell. I have a UIImageView
with autolayout for sizing (constant: 10 for top, L/R, bottom).
When calling the following from tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!)
:
println("w: \(cell.mapSnapshotImageView.bounds.size.width) h: \(cell.mapSnapshotImageView.bounds.size.height)")
I always get:
w: 580.0 h: 80.0
Even though it should be w: 300.0 h: 80.0
based on my 320x100 cell on an iPhone 5S.
Everything displays correctly, but I want to use the width of the subview for some calculations for other subviews. Any ideas as to why this is happening? Bug report or working as designed?
EDIT:
This issue only applies to cells that are loaded initially. When cells are reused, the issue does not present itself. println
output on reused cells:
w: 300.0 h: 80.0