Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contraints leads to conflicts #47

Open
confile opened this issue Jun 18, 2015 · 1 comment
Open

Contraints leads to conflicts #47

confile opened this issue Jun 18, 2015 · 1 comment

Comments

@confile
Copy link

confile commented Jun 18, 2015

I used it on the collapse table view example Apple provided here:

https://developer.apple.com/library/ios/samplecode/TableViewUpdates/Introduction/Intro.html

I used the not cached version of this plugin. When I click on a section header to open the rows in the section then I get the following error:

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) 
(
    "<_UIScrollViewAutomaticContentSizeConstraint:0x7a09e6a0 UITableView:0x7c1d4400.contentHeight{id: 178} == -5.000000>"
)

Will attempt to recover by breaking constraint 
<_UIScrollViewAutomaticContentSizeConstraint:0x7a09e6a0 UITableView:0x7c1d4400.contentHeight{id: 178} == -5.000000>

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.

My Custom Cell looks like this:

class MyCell: UITableViewCell {

   override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
      super.init(style: style, reuseIdentifier: reuseIdentifier)
      setupView()
   }

   private func setupView() {
      let addButton = UIButton.buttonWithType(UIButtonType.Custom) as! UIButton 
      self.contentView.addSubview(addButton)
      addButton.snp_makeConstraints { (make) -> Void in
          make.edges.equalTo(self.contentView).priorityLow()
      }
  }
}

How can I fix this issue?

@confile
Copy link
Author

confile commented Jun 18, 2015

To make autolayout in code I use: https://github.com/SnapKit/SnapKit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant