On 20. Dec 2014, at 20:39, Quincey Morris <quinceymor...@rivergatesoftware.com> wrote:
> On Dec 20, 2014, at 12:08 , H Miersch <hmier...@me.com> wrote: >> >> if I DO call [self setTranslatesAutoresizingMaskIntoConstraints:NO]; on the >> subview, the window and its view behave normally, but the subview doesn't >> appear, its drawrect method is not called, nothing. >> >> so what am i doing wrong? > > It sure sounds like the custom view is having its size forced to zero because > it has no size (or other) constraints that keep this from happening. it looks like that didn't help. maybe i've made a mistake with the size constraints, or maybe there's something else wrong. i have a method that calculates the required height for the subview. here's the code i added to that method: [self setFrameSize:NSMakeSize(width, height)]; if (heightConstraint) { [self removeConstraint:heightConstraint]; heightConstraint = nil; } if (widthConstraint) { [self removeConstraint:widthConstraint]; widthConstraint = nil; } heightConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:height]; [self addConstraint:heightConstraint]; widthConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:width]; [self addConstraint:widthConstraint]; did i screw up? wouldn't surprise me, since this is my first project where i use constraints in codeā¦ come to think of it, should i add the constraints to the superview instead of self? gonna try that...
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com