Hi,
We have an app where a table view presents our contents and every cell’s height is calculated dynamically by auto layout through the constraints that are on the cell.
We would now like to show a single tweet in our apps and we have been able to download the tweet of type TWTRTweet and are now initializing our TWTRTweetView with it.
The issue is that when the TWTRTweetView is initialized with the TWTRTweet object, it doesn’t automatically resize itself and therefore our table view cell doesn’t size itself either.
We then started to add custom constraints to the tweet view like so:
tweetView.translatesAutoresizingMaskIntoConstraints = false
let leading = NSLayoutConstraint(item: tweetView, attribute: .Leading, relatedBy: .Equal, toItem: contentView, attribute: .Leading, multiplier: 1.0, constant: 0.0)
let trailing = NSLayoutConstraint(item: tweetView, attribute: .Trailing, relatedBy: .Equal, toItem: contentView, attribute: .Trailing, multiplier: 1.0, constant: 0.0)
let top = NSLayoutConstraint(item: tweetView, attribute: .Top, relatedBy: .Equal, toItem: contentView, attribute: .Top, multiplier: 1.0, constant: 0.0)
let bottom = NSLayoutConstraint(item: tweetView, attribute: .Bottom, relatedBy: .Equal, toItem: contentView, attribute: .Bottom, multiplier: 1.0, constant: 0)
let height = NSLayoutConstraint(item: tweetView, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .Height, multiplier: 1.0, constant: tweetViewSize.height)
NSLayoutConstraint.activateConstraints([leading, trailing, top, bottom, height])
But that is only making the tweet view big. The contentView of our cell is not stretching vertically, so that the tweet is now flooding vertically over the cells under it and covering them.
Has anybody used self sizing table view cells with Twitter SKD?