I'd like to have a small info-style button in the lower left corner of my screen, and added this code (no xib):
- (void)setupInfoButton { UIButton *infoButton = [UIButton buttonWithType: UIButtonTypeInfoDark]; [infoButton addTarget: self action: @selector(showInfo:) forControlEvents: UIControlEventTouchDown]; infoButton.showsTouchWhenHighlighted = YES; [self.view addSubview:infoButton]; [self.view bringSubviewToFront:infoButton]; infoButton.translatesAutoresizingMaskIntoConstraints = NO; NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(infoButton); [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @"H:|-15-[infoButton]" options: 0 metrics: nil views: viewsDictionary]]; [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @"V:[infoButton]-15-|" options: 0 metrics: nil views: viewsDictionary]]; } Alas, it is not showing up. I played around with the values of the constraints to move it more to the middle, but still it is not there. By using bringSubviewToFront: I force it to be the front most view, so it is no masked by other views. Any one sees what I am missing? Thanks, - Koen. _______________________________________________ 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