uitableview - iOS 7 incorrect calculation of UITableViewCell height on first pass -


I am trying to calculate the height of my UITableViewCell subclasses in iOS 7 and I feel that, for the first time On passing, the calculation is wrong. However, if I reload the table view after each other, the calculation is actually correct on the other pass here. Here's how I am calculating cell height:

  if (_prototypeHeader == Zero) {_prototypeHeader = [[[NSBundle mainBundle]] loadNibNamed: NSStringFromClass ([DDStatusTableViewCell class]) Owner: option no equal: 0] last object]; } [_prototypeHeader setFrame: CGRectMake (0, 0, CGRectGetWidth (tableView.frame), 0)]; [_Propo otype headerconfiguremenmenu: self Restaurants on the menu: self Restaurant]; [_prototypeHeader setNeedsLayout]; [_Pro otyPhider LayerInzid]; CGSize size = [_prototypeHeader.contentView systemLayoutSizeFittingSize: UILayoutFittingCompressedSize]; NSLog (NSStringFromCGSize (size)); Return size. Hate + 1;  

The log statement size goes into entering this:

  2014-10-28 10: 15: 45.492 MyApp [39.225: 613] {350 , 77} & lt; --- This is wrong 2014-10-28 10: 15: 46.495 MyApp [39.225: 613] {294, 110} & LT; --- It is true  

I have also logged out the tableview width in both the circumstances and it is a consistent 320. Does it seem to have only one issue in iOS 7?

Thank you!

edit

After further inspection, I have determined that the layout width of my top labels is wrong SUVU method within the label's layout, I Do so:

  - (zero) layouts subviews {[super layout slides]; Self.titleLabel.preferredMaxLayoutWidth = self.titleLabel.frame.size.width; Self.detailLabel.preferredMaxLayoutWidth = self.detailLabel.frame.size.width; [Super layout index view]; }  

In the first pass, the title labels have a width of 170, while in the second pass, the width is 130. Still, why is it trying to find out? The width of the content view is 360 during the first pass, and the second pass falls below 320. It seems that the layout code that adjusts the amount of content before the content view has adjusted its size.

Before changing the favorite, MXLayoutWidth starts doing the trick while trying to layout the content.

  - (zero) layout attributes {[Super Layout Edit}; [Self. Contentview layout inserted]; Self.titleLabel.preferredMaxLayoutWidth = self.titleLabel.frame.size.width; Self.detailLabel.preferredMaxLayoutWidth = self.detailLabel.frame.size.width; [Super layout index view]; }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -