Closed puelocesar closed 10 years ago
I'm guessing that it has something to do with the promotion/teacup integration. I'll try and look at this soon, but a call to view.apply_constraints
might accomplish something...
Hmm, it seems to be related to ProMotion, as I found a bug report on their repository: https://github.com/clearsightstudio/ProMotion/issues/276?source=c
Anyway, calling apply_constraints is getting me the following errors, crashing the app:
{NSLayoutConstraint:0xc0e8060 UIImageView:0xc0e4140.bottom == UIView:0xc1b9750.bottom priority:750}
When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.
2013-10-08 20:02:19.228 LumieVideo[49220:a0b] View hierarchy unprepared for constraint.
Constraint: {NSLayoutConstraint:0xc0e8060 UIImageView:0xc0e4140.bottom == UIView:0xc1b9750.bottom priority:750}
Container hierarchy:
{UIImageView: 0xc0e4140; frame = (0 0; 320 200.5); opaque = NO; userInteractionEnabled = NO; layer = {CALayer: 0xc0ec440}}
View not found in container hierarchy: {UIView: 0xc1b9750; frame = (0 0; 320 568); autoresize = W+H; layer = {CALayer: 0xc1b9f10}}
That view's superview: {UIWindow: 0xc1b8c30; frame = (0 0; 320 568); autoresize = W+H; gestureRecognizers = {NSArray: 0xc1b9270}; layer = {UIWindowLayer: 0xc1b8e10}}
2013-10-08 20:02:20.281 LumieVideo[49220:a0b] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:{NSLayoutConstraint:0xc0e8060 UIImageView:0xc0e4140.bottom == UIView:0xc1b9750.bottom priority:750} view:{UIImageView: 0xc0e4140; frame = (0 0; 320 200.5); opaque = NO; userInteractionEnabled = NO; layer = {CALayer: 0xc0ec440}}'
By the way, I changed the constraints to be just: "constrain_bottom(0)", I tried this because of this message saying it references views outside the tree
Changed my code to:
class HomeScreen < PM::Screen
stylesheet :home
layout :home do
subview(Viu.imagem("background.jpg"), :background)
subview(Viu.imagem("home/mancha.png"), :mancha)
end
def will_appear
end
end
And now it's working...
Thanks! In the future please "close" issues if they're resolved.
Ok, I'm using ProMotion with TeaCup, but I can't get constraints to work. Here's my code:
So, the style named "background" works, but the style named "mancha" simply does nothing. It's like teacup is ignoring everything inside "constraints" array.
What I am missing?