size-classes

AutoLayout Size Classes - different proportional heights

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:54:46
问题 I need to set the height of a subview to be proportional to its parent. On iPads, I need it to be one third of the height while on iPhones I need it to be one half. In the "AnyAny" size class, I create the constraint and set the multiplier to 0.3333333. This does what it should on iPads. When I change the size class to "CompactRegular", I change the multiplier of the constraint to 0.5. Although this makes it half on iPhones, it also does it for iPads. How do I make it such that the size

Different size classes for iPad portrait and landscape modes with containerviews

本小妞迷上赌 提交于 2019-12-05 21:25:36
I've found this question and I've tried to implement the solution that has been given. However I run into a problem. My initial view controller has two container views who both have their own view controller. I've created a root view controller that is assigned to the initial view controller. The code in this class looks like this. class RootViewController: UIViewController { var willTransitionToPortrait: Bool! var traitCollection_CompactRegular: UITraitCollection! var traitCollection_AnyAny: UITraitCollection! override func viewDidLoad() { super.viewDidLoad() setupReferenceSizeClasses() // Do

Changing the multiplier of a constraint based on size class

此生再无相见时 提交于 2019-12-05 19:09:53
问题 Is it possible to give a constraint a different multiplier depending on the current size class? I have a view that I want to be half the size of the screen for a regular size class width and I want it to be 80% of the size of the screen for a compact size class width. In the storyboard I have the option to add different variables for different size classes to the constraints constant value, but not it's multiplier value. It's an Equal Widths Constraint in case that is relevant. I haven't done

Size Classes to distinguish between iPhone 5, 6 and 6 Plus?

丶灬走出姿态 提交于 2019-12-05 03:47:40
I was very happy to learn that Size Classes are backward compatible with iOS 7 (in some cases). Now I'm wondering - is there a way to use Size Classes to distinguish between iPhone 5, 6 and 6 Plus? No. Quite the opposite actually, size classes are used to abstract the device away. These are the currently used size class: compact width, compact height: 3.5", 4", 4.7" iPhones in Landscape mode compact width, regular height: all currently available iPhones in Portrait regular width, compact height: 5.5" iPhone in Landscape regular width, regular height: all currently available iPads regardless of

Different font size for UILabel using adaptive layout

只愿长相守 提交于 2019-12-05 02:35:46
In Xcode 6 we have a new feature called adaptive layout. By using that I have created a new project in which it I need to have different font size based on the layout. In iPhone 3.5 inch screen I must have font size as 17pt, and other screen size in iPhone must be 21pt. Can anyone tell me how I can achieve this using adaptive layout? Yes, you can do with storyboad. There is a + sign on the left of the font, click it and select the size class and choose the font size needed In viewDidAppear or viewWillAppear, you can detect the size of the layout. You only have to update font size based on the

Adaptive swapping of View Controllers in response to Size Class Trait changes iOS 9

孤街醉人 提交于 2019-12-04 19:28:09
(I have read other answers on this subject, but they refer to older tech and practices.) I have also read: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html I have an iOS app featuring 3 pages (1 per tab). The storyboard architecture is as follows: TabBarController -> Navigation Controller 1 -> View Controller 1 -> Navigation Controller 2 -> View Controller 2 -> Navigation Controller 3 -> View Controller 3 The app features major UI design differences when used on a small device (e.g. iPhone portrait) vs a large one (e.g. iPad fullscreen.

what are the size classes for the new iPhone X models?

不羁岁月 提交于 2019-12-04 19:11:24
Apple has introduced three new iPhone X models: the iPhone XR, XS, and XS Max. What are their size classes, and how do these compare to other iPhone models? I'll give three pieces of information for each model: the size classes when in portrait, the size classes when in landscape, and the screen resolution. ↔︎ means horizontal (width) size class ↕︎ means vertical (height) size class The good old-fashioned standard is something like the iPhone 6s: iPhone 6s: ↔︎ compact, ↕︎ regular; ↔︎ compact, ↕︎ compact; 2.0 The three models with Plus in their name, however, when in landscape, are regular,

AutoLayout Size Classes - different proportional heights

橙三吉。 提交于 2019-12-04 15:00:44
I need to set the height of a subview to be proportional to its parent. On iPads, I need it to be one third of the height while on iPhones I need it to be one half. In the "AnyAny" size class, I create the constraint and set the multiplier to 0.3333333. This does what it should on iPads. When I change the size class to "CompactRegular", I change the multiplier of the constraint to 0.5. Although this makes it half on iPhones, it also does it for iPads. How do I make it such that the size classes would have different multipliers? You'll need to add a new constraint for Compact/Regular, and make

Animate changes during device rotation based on size element will be after rotation completes

柔情痞子 提交于 2019-12-04 09:31:04
问题 I have a dynamic setup of buttons that automatically adjust in width and height based on auto layout constraints set up in a storyboard. When in portrait the buttons have equal widths and heights so the frame is perfectly square, and when the device is rotated to landscape the buttons get shorter and wider. I have set cornerRadius on the buttons' layers so they're perfectly circular when in portrait and that works well, but when I rotate to landscape the corner radius doesn't look right

Any-Any size class ignored for ios7

浪尽此生 提交于 2019-12-04 03:56:16
I'm developing for both iOS7 and 8 iPhone. Since iOS7 doesn't support compact-height size classes, I thought the consensus way to go about this was to use the any-any size class for landscape iPhone layouts, and use portrait compact-width regular-height (cWrH) size class for portrait iPhone layouts. I set a constraint on a view in any-any, then modify a constraint constant in cWrH to be specific to that size class. However, iOS7 device as well as Xcode preview ignores the any-any constraint, and uses the cWrH constraint for both portrait and landscape orientations. I have no clue why this is