Questions tagged [uitraitcollection]

UITraitCollection - allow to access the iOS interface environment by traits such as horizontal and vertical size class, display scale, and user interface idiom

84 questions
0
votes
1 answer

Tab Bar Ignoring UITraitCollection requests - 6 Tabs Desired

I'm using the following code to trick my application into believing it's an iPad and displaying 6 tabs on the tab bar. -(UITraitCollection *)traitCollection { UITraitCollection *realTraits = [super traitCollection], *lieTrait =…
0
votes
1 answer

How to deal size classes with a View Model in iOS Applications?

I was wondering how to properly deal the size classes in my iOS app. I had 2 different designs. Should this be managed in the view controller or the view model? Do I need to embed the Trait collection in the viewModel?
CarlosAndres
  • 585
  • 1
  • 5
  • 14
0
votes
1 answer

Set collection view cell size relative to screen size swift

I am Trying to resize my cell based on the screen size so that there is only 2 cell per row. I am using the code func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath:…
c3pNoah
  • 65
  • 1
  • 12
0
votes
1 answer

Wrong frame for view in tableView.tableHeaderView after a second rotation

I want to build a simple Swift 3 iOS 10 app with two different layouts according to size classes. When my viewController has a traitCollection.verticalSizeClass of type .regular, I want my blueView (a subclass of UIView) to be the…
Imanou Petit
  • 89,880
  • 29
  • 256
  • 218
0
votes
1 answer

Storyboards landscape mode with Trait collections

I have an app that only works in Landscape mode and am using storyboard to layout views. The problem is using Trait collections/size classes the view is by default shown in portrait mode that makes it difficult to layout. I am unable to find anyway…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
0
votes
1 answer

How do I check the current size class for the screen from within a nested child view controller?

I have a screen in my app with multiple child view controllers. On smaller screen sizes like iPhone, the view controllers are placed flush against each other. On iPad screen sizes, one of the view controllers floats on top of the other. I want to…
Rikki Gibson
  • 4,136
  • 23
  • 34
0
votes
0 answers

UITraitCollection doesn't have any information after custom segue

When I return to my home screen after a logout, it can't return any information about its traitCollection. I would like to get its size class and it is not possible. When I run the screen without any segue it has all the…
angeldev
  • 1,983
  • 3
  • 18
  • 29
0
votes
1 answer

UITraitCollection Class for Updating the Size Class

Shall i use UITraitCollection Class for Updating the Size Class constraints? Is this Best Practice to update the Constraints? I have gone through the UITraitCollection, but don't know how to differentiate portrait and Landscape?
prakashsys
  • 125
  • 1
  • 9
-1
votes
1 answer

How can I detect when the system changes dark/light mode in Swift?

I know there are plenty of answers pointing to traitCollectionDidChange, but that is going to be called when the userInterfaceStyle of a view controller changes, and I would like to let the user select between System, Light and Dark mode, so I am…
1 2 3 4 5
6