Closed ph1ps closed 8 years ago
Button doesnt show up for me when using storyboard with this PL
@kiwo12345 Hmm can't reproduce... Can you upload your project?
@ph1ps Yeah I tried yours and it didnt work. Though the example works just fine which is strange. But if I add self.layoutIfNeeded() the button will show up but it will also cast a constraint error:
"<NSLayoutConstraint:0x608000093920 App.DOFavoriteButton:0x7ff542d33fc0.height == 44 (active)>",
"<NSLayoutConstraint:0x608000093b00 '_UITemporaryLayoutHeight' App.DOFavoriteButton:0x7ff542d33fc0.height == 1000 (active)>"
It almost feels like it wont work if you have alot of views/stuff going on in your VC. I will try to add the button by code and see what happens :)
@kiwo12345 Yeah right after your comment I noticed that too. If you change just 1 constraint it breaks. Adding the button by code works but try setting constraints there. Maybe you could tell me your results. I will definitly look into it later. Thanks!
@ph1ps I could not get it to work by code either :/
I added the button in viewdidload by:
let width = (self.view.frame.width - 44) / 4
var x = width / 2
let y = self.view.frame.height / 2 - 22
let starButton = DOFavoriteButton(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "table-select.pdf"))
self.view.addSubview(starButton)
But the button will take up the whole screen:
@ph1ps The same issue using this lib: https://github.com/xhamr/fave-button
@kiwo12345 I will close the PR for now, this project seems to be much more broken than I thought.
@ph1ps Finally found a "fix"!! If you set the constraint priority (on all button constraints) to anything under 1000 it will work using storyboard. Right now I have 6 constraints added to my button once I set their priority to 750 the error didnt show
Edit Set the button height/width constraint to a priority of 750
@kiwo12345 Found that too but the the button was all stretched when I tried that...
@ph1ps did you try to lower the constraint priority when using storyboard? At leats that works for me now. Seems like once you call self.layoutIfNeeded() two constraints gets added while the button is drawn so lowering fixes it
Adressing #31 and #32