Convenience methods for instantiating UITraitCollections for specific devices
| Originator: | greg | ||
| Number: | rdar://17226100 | Date Originated: | 06/08/2014 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | Enhancement | Reproducible: | n/a |
Summary:
Might be nice to have methods like the following instead of needing to remember what is regular and what is compact.
+ [UITraitCollection traitCollectionWithTraitsFromPhonePortrait];
+ [UITraitCollection traitCollectionWithTraitsFromPhoneLandscape];
etc.
Steps to Reproduce:
Use this code:
+ [UITraitCollection traitCollectionWithTraitsFromPhonePortrait];
+ [UITraitCollection traitCollectionWithTraitsFromPhoneLandscape];
Expected Results:
More or less, the output from:
static UITraitCollection *phoneLandscape;
static UITraitCollection *phonePortrait;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
UITraitCollection *horizontalRegular = [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
UITraitCollection *horizontalCompact = [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassCompact];
UITraitCollection *verticalRegular = [UITraitCollection traitCollectionWithVerticalSizeClass:UIUserInterfaceSizeClassRegular];
UITraitCollection *verticalCompact = [UITraitCollection traitCollectionWithVerticalSizeClass:UIUserInterfaceSizeClassCompact];
UITraitCollection *phoneDevice = [UITraitCollection traitCollectionWithUserInterfaceIdiom:UIUserInterfaceIdiomPhone];
phoneLandscape = [UITraitCollection traitCollectionWithTraitsFromCollections:@[horizontalCompact, verticalCompact, phoneDevice]];
phonePortrait = [UITraitCollection traitCollectionWithTraitsFromCollections:@[horizontalCompact, verticalRegular, phoneDevice]];
});
Actual Results:
Message does not exist.
Version:
iOS 8
Notes:
Configuration:
iPhone Simulator
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!