Closed NinjaIshere closed 9 years ago
@NinjaIshere Yes it could be :) :+1: good catch will check this out in the am and update you
@NinjaIshere What is the size of the container that the MK card is going within?
@danieldahan -
// card layout
view.addSubview(card)
view.addConstraints(Layout.constraint("V:|-(pad)-[child]", options: nil, metrics: ["pad": 60], views: ["child": card]))
Layout.size(view, child: card, width: 380, height: 310)
card.backgroundColor = MaterialTheme.grey.darken1
If you could copy and paste the entire error output that would be great. But from your code, you have two vertical constraints, and really only need one.
Your height doesn't need to be specified in the second Layout.size statement.
You should try:
view.addConstraints(Layout.constraint("V:|-(pad)-[child(310)]", options: [], metrics: ["pad": 60], views: ["child": card])) Layout.width(view, child: card, width: 380)
Also, where are you getting the width 380 from? Are you trying to set it to the bounds of the view, as in, entirely across the screen. You would be better off doing:
Layout.expandToParentHorizontally(view, child: card)
@danieldahan - I will try what you mentioned above, until then here is the whole error code below, but i have added back the other buttons so there will be lots more constraint issues in the logs. I will post back if the changes above fixed the issue.
2015-09-23 10:45:54.906 RapWordGenerator[65679:10036388] 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:0x7fcc72427260 H:[UILabel:0x7fcc7273b520'Seconds'(70)]>",
"<NSLayoutConstraint:0x7fcc724257e0 H:|-(30)-[UILabel:0x7fcc7273b520'Seconds'] (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc72425830 H:[UILabel:0x7fcc7273b520'Seconds']-(30)-| (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc7257b3a0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start'(180)]>",
"<NSLayoutConstraint:0x7fcc7257b770 H:|-(6)-[MaterialKit.FlatButton:0x7fcc72576d90'Start'] (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc7257b7c0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start']-(6)-| (Names: '|':UIView:0x7fcc724294a0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcc72425830 H:[UILabel:0x7fcc7273b520'Seconds']-(30)-| (Names: '|':UIView:0x7fcc724294a0 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-09-23 10:45:54.909 RapWordGenerator[65679:10036388] 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:0x7fcc7257b3a0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start'(180)]>",
"<NSLayoutConstraint:0x7fcc7257b770 H:|-(6)-[MaterialKit.FlatButton:0x7fcc72576d90'Start'] (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc7257b7c0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start']-(6)-| (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc72431400 H:[MaterialKit.FlatButton:0x7fcc72430810'Stop'(180)]>",
"<NSLayoutConstraint:0x7fcc72431760 H:|-(189)-[MaterialKit.FlatButton:0x7fcc72430810'Stop'] (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc724317b0 H:[MaterialKit.FlatButton:0x7fcc72430810'Stop']-(189)-| (Names: '|':UIView:0x7fcc724294a0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcc724317b0 H:[MaterialKit.FlatButton:0x7fcc72430810'Stop']-(189)-| (Names: '|':UIView:0x7fcc724294a0 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-09-23 10:45:54.910 RapWordGenerator[65679:10036388] 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:0x7fcc72575990 V:|-(8)-[UILabel:0x7fcc7242a100] (Names: '|':UIView:0x7fcc72428990 )>",
"<NSLayoutConstraint:0x7fcc72575b10 V:[UILabel:0x7fcc7242a100(<=144)]>",
"<NSLayoutConstraint:0x7fcc72575b90 V:[UILabel:0x7fcc7242a100]-(8)-| (Names: '|':UIView:0x7fcc72428990 )>",
"<NSLayoutConstraint:0x7fcc72574de0 V:|-(0)-[UIView:0x7fcc72428990] (Names: '|':MaterialKit.BasicCard:0x7fcc7267de30 )>",
"<NSLayoutConstraint:0x7fcc72575050 V:[UIView:0x7fcc72428990]-(0)-| (Names: '|':MaterialKit.BasicCard:0x7fcc7267de30 )>",
"<NSLayoutConstraint:0x7fcc7257d450 V:[MaterialKit.BasicCard:0x7fcc7267de30(310)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcc72575b90 V:[UILabel:0x7fcc7242a100]-(8)-| (Names: '|':UIView:0x7fcc72428990 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-09-23 10:45:55.000 RapWordGenerator[65679:10036388] 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:0x7fcc7257b3a0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start'(180)]>",
"<NSLayoutConstraint:0x7fcc7257b770 H:|-(6)-[MaterialKit.FlatButton:0x7fcc72576d90'Start'] (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc7257b7c0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start']-(6)-| (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc725824a0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fcc724294a0(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcc7257b7c0 H:[MaterialKit.FlatButton:0x7fcc72576d90'Start']-(6)-| (Names: '|':UIView:0x7fcc724294a0 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-09-23 10:45:55.069 RapWordGenerator[65679:10036388] 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:0x7fcc7242f1c0 V:[UILabel:0x7fcc7273b520'Seconds'(70)]>",
"<NSLayoutConstraint:0x7fcc7242b270 V:|-(70)-[UILabel:0x7fcc7273b520'Seconds'] (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc7242b2c0 V:[UILabel:0x7fcc7273b520'Seconds']-(70)-| (Names: '|':UIView:0x7fcc724294a0 )>",
"<NSLayoutConstraint:0x7fcc725824f0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fcc724294a0(667)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcc7242b2c0 V:[UILabel:0x7fcc7273b520'Seconds']-(70)-| (Names: '|':UIView:0x7fcc724294a0 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
So from the constraint issues, I can tell that you are doing quite a bit to the view. Would you be able to add the entire block of code that generates the view and all manipulations you are doing to it. Also, please use dev and pull the latest, which will help determine if you are experiencing a legacy issue.
Thanks!
Those extra constraints issues are from the UISlider and the UILabel (sliderValue) which are being added using the storyboard, but they have no constraints added to them, i have tried completely removing everything and just leaving the "card" and i still get the same type of errors. Whole code posted below also using latest from Dev repo
//
// ViewController.swift
// RapWordGenerator
//
// Created by Mind Ooze on 8/23/15.
// Copyright (c) 2015 NinjaSkillz. All rights reserved.
//
import UIKit
import AVFoundation
import MaterialKit
class ViewController: UIViewController, AVAudioPlayerDelegate
{
var timer: NSTimer?
var audioPlayer = AVAudioPlayer?()
var card: BasicCard = BasicCard()
let wordGen = WordGenerator()
var secondsLabel: UILabel = UILabel()
@IBOutlet weak var slider: UISlider!
@IBOutlet weak var sliderValue: UILabel!
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidLoad()
{
//Seconds label
secondsLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
secondsLabel.text = "Seconds"
view.addSubview(secondsLabel)
Layout.size(view, child: secondsLabel, width: 70, height: 70)
view.addConstraints(Layout.constraint("H:|-(pad)-[child]-(pad)-|", options: nil, metrics: ["pad": 30], views: ["child": secondsLabel]))
view.addConstraints(Layout.constraint("V:|-(pad)-[child]-(pad)-|", options: nil, metrics: ["pad": 70], views: ["child": secondsLabel]))
//material Kit Card
card.detailLabel = UILabel()
card.detailLabel?.textAlignment = .Center
card.detailLabel?.font = UIFont(name:"Arial", size: 45)
view.backgroundColor = MaterialTheme.grey.darken1
var selectValueAsInt = sliderValue.text?.toInt()
super.viewDidLoad()
ShowStartButton()
showStopButton()
// card layout
view.addSubview(card)
view.addConstraints(Layout.constraint("V:|-(pad)-[child]", options: nil, metrics: ["pad": 60], views: ["child": card]))
Layout.size(view, child: card, width: 380, height: 310)
card.backgroundColor = MaterialTheme.grey.darken1
}
@IBAction func sliderValueChanged(sender: UISlider)
{
var selecterValue = Int(sender.value)
sliderValue.text = String(stringInterpolationSegment: selecterValue)
}
@IBAction func startButtonAction(sender: AnyObject)
{
changeWord()
}
@IBAction func stopButtonAction(sender: AnyObject)
{
stopChangingWord()
}
func ShowStartButton()
{
// Start button
var startButton: FlatButton = FlatButton()
startButton.setTitle("Start", forState: .Normal)
// Start button layout
view.addSubview(startButton)
Layout.size(view, child: startButton, width: 180, height: 200)
view.addConstraints(Layout.constraint("H:|-(pad)-[child]-(pad)-|", options: nil, metrics: ["pad": 6], views: ["child": startButton]))
view.addConstraints(Layout.constraint("V:|-(pad)-[child]", options: nil, metrics: ["pad": 465], views: ["child": startButton]))
startButton.backgroundColor = MaterialTheme.grey.darken1
startButton.addTarget(self, action: "startButtonAction:", forControlEvents: .TouchUpInside)
}
func showStopButton()
{
// Stop button
var stopButton: FlatButton = FlatButton()
stopButton.setTitle("Stop", forState: .Normal)
// Stop button layout
view.addSubview(stopButton)
Layout.size(view, child: stopButton, width: 180, height: 200)
view.addConstraints(Layout.constraint("H:|-(pad)-[child]-(pad)-|", options: nil, metrics: ["pad": 189], views: ["child": stopButton]))
view.addConstraints(Layout.constraint("V:|-(pad)-[child]", options: nil, metrics: ["pad":465], views: ["child": stopButton]))
stopButton.backgroundColor = MaterialTheme.grey.darken1
stopButton.addTarget(self, action: "stopButtonAction:", forControlEvents: .TouchUpInside)
}
func changeWord()
{
var sliderValueAsDouble = Double(sliderValue.text!.toInt()!)
timer?.invalidate()
timer = NSTimer.scheduledTimerWithTimeInterval(sliderValueAsDouble, target:self, selector: Selector("changeWord"), userInfo: nil, repeats: false)
card.detailLabel!.text = wordGen.returnWordFromGraphKit() as String;
}
func stopChangingWord()
{
timer?.invalidate()
}
//change app colors
func changeBackgroundColorToRed() {
view.backgroundColor = MaterialTheme.red.darken1
view.reloadInputViews()
}
}
@NinjaIshere Did you try the latest dev with the code you have?
@danieldahan - ya i did it was up to date when i did git pull
You should update again.
BasicCard doesn’t exist in the latest development branch. It is BasicCardView.
On Sep 26, 2015, at 7:13 PM, NinjaIshere notifications@github.com wrote:
@danieldahan https://github.com/danieldahan - ya i did it was up to date when i did git pull
— Reply to this email directly or view it on GitHub https://github.com/GraphKit/MaterialKit/issues/48#issuecomment-143503724.
@danieldahan - hmm weird, i was pulling from wrong directory, I switched over and now i cant build MK, it has like 149 errors, probably something im doing, i might need to recreate the my workspace.
Okay, I just made a huge update to MK 1.14.0
Try that out :)
Daniel Dahan
M: +1 647.627.0770 Skype: djondahan
On Sep 28, 2015, at 9:14 PM, NinjaIshere notifications@github.com wrote:
weird, i was pulling from wrong directory, I switched over and now i cant build MK, it has like 149 errors, probably something im doing, i might need to recreate the my workspace.
https://cloud.githubusercontent.com/assets/8978522/10153007/c4ee1c0e-660c-11e5-81d9-5712ee00f67b.png — Reply to this email directly or view it on GitHub https://github.com/GraphKit/MaterialKit/issues/48#issuecomment-143916452.
I have attached image of my storyboard and it is empty i have commented out most of my code to only show the MK Card
When i add this code to the MK Card I get constraint issues //material Kit Card card.detailLabel = UILabel() card.detailLabel?.textAlignment = .Center card.detailLabel?.font = UIFont(name:"Arial", size: 45) view.backgroundColor = MaterialTheme.grey.darken1
(when i remove the line of code above this issue is gone, could it be the size of the font?)
2015-09-19 09:26:09.075 RapWordGenerator[42757:9240231] 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:0x7f8b8c08e980 V:|-(8)-[UILabel:0x7f8b8c08a4f0] (Names: '|':UIView:0x7f8b8c08c1f0 )>", "<NSLayoutConstraint:0x7f8b8c08ea00 V:[UILabel:0x7f8b8c08a4f0(<=144)]>", "<NSLayoutConstraint:0x7f8b8c08ea80 V:[UILabel:0x7f8b8c08a4f0]-(8)-| (Names: '|':UIView:0x7f8b8c08c1f0 )>", "<NSLayoutConstraint:0x7f8b8c08e860 V:|-(0)-[UIView:0x7f8b8c08c1f0] (Names: '|':MaterialKit.BasicCard:0x7f8b8af1ff10 )>", "<NSLayoutConstraint:0x7f8b8c08e0d0 V:[UIView:0x7f8b8c08c1f0]-(0)-| (Names: '|':MaterialKit.BasicCard:0x7f8b8af1ff10 )>", "<NSLayoutConstraint:0x7f8b8c098310 V:[MaterialKit.BasicCard:0x7f8b8af1ff10(310)]>" )
Will attempt to recover by breaking constraint <NSLayoutConstraint:0x7f8b8c08ea80 V:[UILabel:0x7f8b8c08a4f0]-(8)-| (Names: '|':UIView:0x7f8b8c08c1f0 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.