Re: Adding constrains for anonymous buttons
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