Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
UIButton *bottomButton = [UIButton newAutoLayoutView];
[bottomButton setTitle:@"OKAY" forState:UIControlStateNormal];
[bottomButton setTitleColor:[UIColor colorWithHexString:@"#282828"] forState:UIControlStateNormal];
bottomButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:15.0f];
bottomButton.layer.borderWidth = 1.0f;
bottomButton.layer.borderColor = [[UIColor blackColor] CGColor];
self.bottomButton = bottomButton;
[self.overlay addSubview:bottomButton];
- (void)updateConstraints
[self.bottomButton autoAlignAxisToSuperviewAxis:ALAxisVertical];
[self.bottomButton autoSetDimension:ALDimensionWidth toSize:BOTTOM_BUTTON_WDTH];
[self.bottomButton autoSetDimension:ALDimensionHeight toSize:BOTTOM_BUTTON_HT];
// this makes button appear offscreen (above its superview)
// [self.bottomButton autoPinEdgeToSuperviewEdge:ALEdgeBottom withOffset: 10.0];
[self.bottomButton autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.overlay.bounds.size.height * -1.0 + self.border];
// but using a negative Inset places it correctly in the Superview

This comment has been minimized.

Copy link

smileyborg commented Apr 4, 2014

Sorry for the delay in getting to this, got tied up with some other stuff.

Anyways, this is hard for me to debug without more context. But this line looks overly complicated:
[self.bottomButton autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.overlay.bounds.size.height * -1.0 + self.border];

Can you try just something simple like the below, and see what happens?
[self.bottomButton autoPinEdgeToSuperviewEdge:ALEdgeBottom];

If this is something you can consistently reproduce and have noticed in other cases, it would be very helpful if you could provide a simple runnable project so I can debug it further -- either from scratch, or by modifying an existing project to exhibit this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.