ios - How to determine if NSLayoutConstraint is horizontal or vertical? -
It seems that this should be a simple task, but if a NSLayoutConstraint
is a horizontal or vertical The obstacle?
The only way to try to make this difference is by [constraint description]; Calling
and then the resulting string "V:"
or "H:"
I want to find this information, because of I have around 2 similar restrictions which are prototype
storyboard
UITableViewCell
, the only difference is that supervision
is horizontal Describes the distance, and the second vertical.
Any suggestion would be very helpful!
Edit:
I accepted the reply of Grimozoar because its interpretation is a great answer and the way I am working to parse the details, @ kongtomorrow I also want to give credit, answered me here! Thanks for the help!
Here is the real code that I used to find the hindrance:
NSArray * constraints = [bubble constraints]; (If ([[obstacle first item]], then e-mail: message labels] and [[barrier is second int.] Is aqual: bubble] and amp; amp; amp; amp; amp; amp; Restriction [second part] == NSLayoutAttributeTop) [[Remove the bubble] Restraint: Obstacle];}} The first one above, corresponds to the second itam, and then the second obligation Contributions are to be convinced with the sure certainty that I am seeing the right obstruction, then I remove it and successfully my new obligation - after the description!
Not really VFL
embedded code However, if you check the first attribute on the obligation or the second attribute NSLayoutAttribute
properties, you can do this horizontal or If vertical can be removed, if you are creating your own obstacles with VFL , then they are probably not complicated, so this can be a simple deduction. For example, if you get a feature for the first time on a set of supervision, then NSLayoutAttributeLeft
and the other attribute is NSLayoutAttributeLeft
for a child's view, then it The possibility is horizontal but only probability.
To simply add horizontal / vertical properties, or to maintain the supportive data for each hurdle, possibly parsing the details in the dictionary, possibly subclassing NSLayoutConstraint
Want record h or v
Comments
Post a Comment