UIButton not visible
UIButton not visible
- Subject: UIButton not visible
- From: Koen van der Drift <email@hidden>
- Date: Wed, 26 Jun 2013 15:55:13 -0400
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 (email@hidden)
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:
This email sent to email@hidden