ios - AutoLayout for a left/right aligned view -



ios - AutoLayout for a left/right aligned view -

problem

i'm trying create uitableviewcell subclass work bit in messages app left aligned , right aligned.

when left aligned this... (in pseudo afl code).

|-[image(==30)]-[label]-(>=standard)-|

...and when right aligned be...

|-(>=standard)-[label]-[image(==30)]-|

first solution

i thinking have couple of methods this...

- (void)setupleftalignedconstraints; - (void)setuprightalignedconstraints; - (void)removealignmentconstraints;

so can like...

if (self.leftaligned) { [self removealignmentconstraints]; [self setupleftalignedconstraints]; } else { [self removealignmentconstraints]; [self setuprightalignedconstraints]; }

but know if utilize leading , trailing attributes automagic based on writing direction of current language.

is possible set direction of constraints manually?

i.e. tell if leading left or right edge?

that way need alter setting , constraints work both ways.

ios objective-c autolayout

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -