• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UIButton not visible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: UIButton not visible
      • From: Koen van der Drift <email@hidden>
  • Prev by Date: Re: UnitTest: object Should be Dealllocated
  • Next by Date: Re: UIButton not visible
  • Previous by thread: Re: UnitTest: object Should be Dealllocated
  • Next by thread: Re: UIButton not visible
  • Index(es):
    • Date
    • Thread