steveflack
(Steve Flack)
October 15, 2014, 8:50pm
1
It seems that the UILayoutPriority enum is missing. It’s defined as
enum {
UILayoutPriorityRequired = 1000,
UILayoutPriorityDefaultHigh = 750,
UILayoutPriorityDefaultLow = 250,
UILayoutPriorityFittingSizeLevel = 50,
};
typedef float UILayoutPriority;
in NSLayoutConstraint.h. There are no CC options given for UILayoutPriority.UI… and using (for example) UILayoutPriority.UILayoutPriorityRequired gives an error (error E43: No static member “UILayoutPriorityRequired” on type “UILayoutPriority”).
mh
(marc hoffman)
October 16, 2014, 10:29am
2
Hmm, a float enum? we probably don’t handle this properly.
Thanks, logged as bugs://70068: Nougat: UILayoutPriority enum missing?
steveflack
(Steve Flack)
October 16, 2014, 11:29am
4
I worked around by adding:
private enum UILayoutPriorityConstants : Integer {
UILayoutPriorityRequired = 1000,
UILayoutPriorityDefaultHigh = 750,
UILayoutPriorityDefaultLow = 250,
UILayoutPriorityFittingSizeLevel = 50,
};
at the top of the class and it seemed to work OK to pass into methods that needed them. It looks like the C enum is a standard integer enum but the typedef is a float.
bugs://70068 got closed as fixed for release Bradbury Class
steveflack
(Steve Flack)
November 12, 2014, 8:29pm
6
This is only sort of fixed on 1645. The enum constants are defined individually but not as part of an enum. For example this works
fTitleLabel.setContentHuggingPriority(UILayoutPriorityRequired) forAxis(UILayoutConstraintAxis.UILayoutConstraintAxisVertical);
but this doesn’t
fTitleLabel.setContentHuggingPriority(UILayoutPriority.UILayoutPriorityRequired) forAxis(UILayoutConstraintAxis.UILayoutConstraintAxisVertical);