• 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: Adding constrains for anonymous buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding constrains for anonymous buttons


  • Subject: Re: Adding constrains for anonymous buttons
  • From: Ben Kennedy <email@hidden>
  • Date: Sun, 25 Jan 2015 13:33:51 -0800

On 25 Jan 2015, at 7:32 am, Aaron Lewis <email@hidden> wrote:

> I'm trying to create a "label group", so I decided to generate 3
> buttons and put them in a single line, evenly sized and evenly spaced.

What do you mean by "label group"?  Would UILabel be more suitable than UIButton?  (I presume that your for-loop preamble was just illustrative, since it seems atypical to assign buttons into a C array and without any target/action.)

> But these buttons are un-named, is it impossible to use
> constraintsWithVisualFormat now? e.g

Given your code, what about something like this:

NSString *format = @"|[button0][button1(==button0)][button2(==button0)]|";

NSDictionary *views = @{
                        @"button0" : buttons[0],
                        @"button1" : buttons[1],
                        @"button2" : buttons[2],
                        };

NSArray *constrants = [NSLayoutConstraint constraintsWithVisualFormat:format options:0L metrics:nil views:views];

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca






_______________________________________________

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: 
 >Adding constrains for anonymous buttons (From: Aaron Lewis <email@hidden>)

  • Prev by Date: Crash in libsystem_kernel.dylib`__workq_kernreturn:
  • Next by Date: Re: Crash in libsystem_kernel.dylib`__workq_kernreturn:
  • Previous by thread: Adding constrains for anonymous buttons
  • Next by thread: What's the right way to use UIActivityIndicatorView? After it's stopped
  • Index(es):
    • Date
    • Thread