• 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
Re: UIButton not visible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIButton not visible


  • Subject: Re: UIButton not visible
  • From: Koen van der Drift <email@hidden>
  • Date: Wed, 26 Jun 2013 16:24:39 -0400

Ok, I solved it. I had to change the order of views that I create, and  put the infobutton to the end.

- Koen.



On Jun 26, 2013, at 3:55 PM, Koen van der Drift <email@hidden> wrote:

> 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


References: 
 >UIButton not visible (From: Koen van der Drift <email@hidden>)

  • Prev by Date: UIButton not visible
  • Next by Date: NSSplitView similar to Xcode's editor/debug area split view
  • Previous by thread: UIButton not visible
  • Next by thread: NSSplitView similar to Xcode's editor/debug area split view
  • Index(es):
    • Date
    • Thread