【发布时间】:2015-05-02 16:55:44
【问题描述】:
最近我发现当我在 iOS 7 设备上运行我的应用程序时,编译器会返回一个错误。运行 iOS 8 的设备不会发生这种情况。
我能以某种方式理解这是NSLayoutConstraints 的问题。我不知道是什么让它发生。我需要在不禁用自动布局功能的情况下修复它。
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7be4c240 V:[UIView:0x7be31100]-(11)-| (Names: '|':UITableViewCellContentView:0x7be2f2c0 )>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-05-02 19:41:28.652 LM[27669:607] -[<CALayer: 0x7bfcf010> display]: Ignoring bogus layer size (99999.000000, 99999.000000)
2015-05-02 19:41:28.681 LM[27669:607] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7bf1d4b0 V:|-(14)-[UIView:0x7bf1a2c0] (Names: '|':UITableViewCellContentView:0x7bf1a220 )>",
"<NSLayoutConstraint:0x7bf1d510 V:[UIView:0x7bf1a2c0]-(11)-| (Names: '|':UITableViewCellContentView:0x7bf1a220 )>",
"<NSAutoresizingMaskLayoutConstraint:0x81082660 h=--& v=--& V:[UITableViewCellContentView:0x7bf1a220(1)]>"
)
更新:
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7bac9bf0 V:[UILabel:0x7bac8c00]-(65)-| (Names: '|':UIView:0x7bac6f60 )>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-05-03 00:21:03.508 MesProject[27971:607] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7bac9c20 V:|-(54)-[UILabel:0x7bac8c00] (Names: '|':UIView:0x7bac6f60 )>",
"<NSLayoutConstraint:0x7bad4010 V:[UIImageView:0x7bac6490]-(56)-| (Names: '|':UIView:0x7bac6f60 )>",
"<NSLayoutConstraint:0x7bac88f0 V:[UILabel:0x7bac8c00]-(8)-[UIImageView:0x7bac6490]>",
"<NSLayoutConstraint:0x7bac6180 V:[UIView:0x7bac6f60]-(0)-| (Names: '|':UIView:0x7bac4f20 )>",
"<NSLayoutConstraint:0x7bac61e0 V:|-(0)-[UIView:0x7bac6f60] (Names: '|':UIView:0x7bac4f20 )>",
"<NSLayoutConstraint:0x7bac9a70 V:|-(14)-[UIView:0x7bac4f20] (Names: '|':UITableViewCellContentView:0x7bac9e80 )>",
"<NSLayoutConstraint:0x7bac9ad0 V:[UIView:0x7bac4f20]-(11)-| (Names: '|':UITableViewCellContentView:0x7bac9e80 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7ed4a170 h=-&- v=-&- UITableViewCellContentView:0x7bac9e80.height == UITableViewCellScrollView:0x7bacb240.height>",
"<NSAutoresizingMaskLayoutConstraint:0x7ed4a7f0 h=-&- v=-&- UITableViewCellScrollView:0x7bacb240.height == MesProject.CardCell:0x7bac9cf0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x7ed40a00 h=-&- v=--& V:[MesProject.CardCell:0x7bac9cf0(1)]>"
)
当我支持具有行高和动态的 IOS7 时,开始出现此错误。
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 280
}
我有一个名为CardCell的自定义单元格:
class CardCell: UITableViewCell {
@IBOutlet var mainView: UIView!
@IBOutlet weak var text1: UILabel!
@IBOutlet weak var sharefb: UIButton!
}
是否可以使视图和UITextLabel 动态化?
【问题讨论】:
-
除了给定的答案,我什么都不知道。由于它无法修复它,我将其删除,希望有人能够帮助您!
-
你已经尽力了!
标签: ios swift storyboard autolayout