Questions tagged [size-classes]

Size-class is an iOS system to allow for customizing layout, for different devices (phone versus pad, small versus large), while maintaining only the one storyboard. Each device/orientation has a "trait collection" used by autolayout.

size-classes
Filter by
Sorted by
Tagged with
104 votes
14 answers
17k views

Custom Font Sizing in Xcode 6 Size Classes not working properly with Custom Fonts

Xcode 6 has a new feature where fonts and font sizes in UILabel, UITextField, and UIButton can be set automatically based on the size class of the current device configuration, right in the storyboard....
mnemia's user avatar
  • 1,549
100 votes
7 answers
25k views

Sizing class for iPad portrait and Landscape Modes

I basically want to have my subviews positioned differently depending upon the orientation of the iPad (Portrait or Landscape) using Sizing Classes introduced in xcode 6. I have found numerous ...
neelIVP's user avatar
  • 1,001
46 votes
4 answers
24k views

Programmatically implementing two different layouts using size classes

I have a four buttons layout. In portrait they should be shown one above the other. In landscape they should be in two columns each with two buttons. I implement the buttons in code - really simple ...
Joseph's user avatar
  • 9,251
45 votes
5 answers
30k views

iOS- Detect current size classes on viewDidLoad

I'm working with adaptive Layout on iOS 8 and I want to get exactly what the size classes are on viewDidLoad. Any ideas about that?
user3193307's user avatar
41 votes
0 answers
1k views

How to Update Frames for all Size Classes in a Storyboard in Xcode 6.1?

When working with Storyboard files in Interface Builder on Xcode 6.1, Apple recommends designing for the Any/Any size class. When finished, different size classes sometimes report warnings: Misplaced ...
Dave Gallagher's user avatar
39 votes
2 answers
10k views

iOS 8 size classes for iPad landscape [duplicate]

It seems all the current iOS devices maps to the new iOS 8 size classes nicely except iPad landscape? I seem not able to figure out how to use the size class feature to draw a different scene for ...
Sean's user avatar
  • 3,005
30 votes
1 answer
4k views

Why compact width and compact height in iPhone 4,5,6 in landscape orientation

I am new in iOS development and just studying Adaptivity and Layout I am stuck with a little confusion, As per the Documentation iOS defines two size classes: Regular :- It is associated with ...
Shree Krishna's user avatar
27 votes
4 answers
17k views

iPad Landscape and Portrait different layouts with Size Class

How to design iPad Landscape and Portrait screens with different Layouts using Size class. I could find only w-regular and h-regular for both orientations. Example: I need to align 2 views vertically ...
Harish Kumar Kailas's user avatar
22 votes
4 answers
20k views

UIScrollView in Storyboard not working with iOS 8 Size Classes and Autolayout

So I'm trying to create a UIScrollView only in storyboard that allows me to add scrolling labels for more than the height of the VC. Here's what I did: Created UIScrollView that took up the size of ...
Lucas's user avatar
  • 713
22 votes
5 answers
12k views

Size class specifically for portrait 3.5 inch (iPhone 4S) Xcode 6?

I'm tuning my UI App, but I got an issue that I can't solve. As I can see Compact height affects all iPhones under 4.7 inches, but my UI is fine except for the iPhone 4S (3.5 inches). I don't want ...
Helen Wood's user avatar
  • 1,882
18 votes
7 answers
18k views

iOS Different Font Sizes within Single Size Class for Different Devices

In iOS 8, we can design a different UI layout for each size class. The issue I'm facing is, I've designed a layout for Compact Width and Regular Height (size class for all iPhones in portrait) but i ...
Maverick's user avatar
  • 3,229
18 votes
4 answers
13k views

iOS different constraints for different devices

I have a ViewController designed for iPhone SE As you can see I also have a constraint Align Top to: Safe Area Equals 75 The question is, is it possible to change this value for iPhone 8 and iPhone ...
xskit's user avatar
  • 431
17 votes
1 answer
2k views

Using Size Classes in IBInspectable properties

Is there a way we can make our IBInspectable properties feature Size Classes in Interface Builder? (Similar to Font) Clicking the '+' sign would allow you to choose a different font (size and other ...
chrisamanse's user avatar
  • 4,299
15 votes
1 answer
12k views

Use Size Classes in Xcode 6 beta

Built a new project from scratch in Swift in Xcode 6 (Beta 1) and see File Inspector of Storyboard. There is Use Size Classes below Use Auto Layout. This is the screenshot of this. 1) What is Use ...
Yogesh Suthar's user avatar
15 votes
2 answers
4k views

Offscreen UITableViewCells (for size calculations) not respecting size class?

I am using Auto Layout and size classes inside a UITableView with cells that self-size based on their content. For this I'm using the method where for each type of cell, you keep an offscreen instance ...
KennyDeriemaeker's user avatar
14 votes
1 answer
9k views

Using size classes programmatically

I (hopefully) watched all the relevant WWDC2014 session videos and read the docs, so this question is mostly to confirm my suspicions, but please educate me. What I want to do is animate views using ...
Kolja's user avatar
  • 1,227
14 votes
2 answers
7k views

iOS viewWillTransitionToSize and device orientation

I'm using viewWillTransitionToSize to detect when a device is rotating to landscape. Depending on the target size, I can detect if heading for landscape and adjust my traits as required... override ...
Fittoburst's user avatar
  • 2,255
13 votes
1 answer
5k views

iPad Pro size classes

In Xcode 7.1 beta 1 only the usual compact and regular size classes are available—in Interface Builder and in code. Will there be new size classes coming for the iPad Pro? It would also be ...
Frank Rupprecht's user avatar
12 votes
2 answers
3k views

Changing the multiplier of a constraint based on size class

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 ...
Tiddly's user avatar
  • 1,620
12 votes
2 answers
3k views

How To Reset A Size Class Auto-Layout Back To Its wAny hAny Defaults?

I am working on a specific size class layout of an xcode project and I hit a snag. My constraints got very messed up and I want to restart the view. Is there a way in the interface builder for me to ...
Aggressor's user avatar
  • 13.5k
11 votes
2 answers
151 views

Changing Base value layout for iphone, affects ipad layout

I have a layout with size class width any, height any which is currently working for iPad landscape. I have a task to design same layout for iPhone portrait. When I started designing with size class ...
sujay's user avatar
  • 1,845
9 votes
1 answer
1k views

is it possible to provide different images for UIImageView on different size classes

I am developing an universal application with iOS8 size classes. I have a imageview which has to show different images on iPad and iPhone, I don't want to use two imageviews and install each on ...
Ali Aksakarya's user avatar
9 votes
2 answers
4k views

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

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?
YogevSitton's user avatar
  • 10.1k
9 votes
2 answers
2k views

Different font size for UILabel using adaptive layout

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 ...
Arasuvel's user avatar
  • 2,992
9 votes
1 answer
1k views

UITableViewCell dynamic height does not work with size classes

Setting estimatedRowHeight and rowHeight of UITableView makes the table view calculate proper height of each cell. That works like a charm until I use size classes. It seems like all the calculations ...
Darek Cieśla's user avatar
8 votes
6 answers
6k views

Can't change Constraint IBOutlet that is defined for different size classes in IB

I made a special test app for this case. (I'm sorry it is already removed) I added a view on my controller's view in Storyboard, set up AutoLayout constraints in Interface Builder and made one of ...
Sander's user avatar
  • 1,365
8 votes
2 answers
5k views

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

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 ...
Jordan H's user avatar
  • 54k
8 votes
2 answers
6k views

how to set a different constraint for different size classes

I want a view to have width 0.4 screen width in landscape and 0.5 screen width in portrait. So I have tried "vary for traits". I selected wC hR and set 0.5 and clicked "done". Then I selected wR hR ...
Steblo's user avatar
  • 625
8 votes
1 answer
4k views

What is the easiest to get the size class of a UIViewController?

In the WWDC 2014 Platform State of the Union lecture Apple Engineer introduced size classes and he said we can think iPhone size UI as a compact size class and iPad size class as a regular size class. ...
János's user avatar
  • 34k
8 votes
2 answers
8k views

launch screen xib not displaying imageview correctly

I'm using a launch screen xib and I can't get the image within the UIImageView to appear. Currently, I have a UILabel with the imageView placed right below the label and also centered horizontally. ...
Brosef's user avatar
  • 3,015
8 votes
3 answers
5k views

How do I handle iPhone 6S Plus's font size?

iPhone 6S Plus's screen is very big compared to other screen sizes. I can't seem to find a good way to handle the font size of a label without adjusting the size programmatically. How can I adjust ...
Cesare's user avatar
  • 9,269
8 votes
2 answers
1k views

How do I reset specific size class data on a storyboard in Xcode6?

I am using size classes to create a storyboard that can target all the various screen sizes and orientations. I have been working in the Any Width-Any Height size class. I ran into a display issue and ...
reshat2's user avatar
  • 213
8 votes
3 answers
1k views

How can I create a segue that will use a popover on iPad, and push onto the navigation stack on the iPhone?

In my app, there are certain view controllers where on iPad (or to be more specific, a regular horizontal size class) it makes sense to present them as popovers, but on iPhone (or a compact horizontal ...
Chris Vasselli's user avatar
8 votes
1 answer
597 views

Can Size Classes / Trait Collection in iOS be used programmatically when not using Autolayout

I am not using Auto Layout however I wish to be able to make my (very complex) app adapt to Split View multi-tasking on the iPad. For this, ideally to do it right, I want to support size classes ...
strangetimes's user avatar
  • 5,043
8 votes
0 answers
2k views

Failed to render and update auto layout status

Since few days ago I'm getting this error and I'm completely stuck on my project. This is just a Runtime issue, I can run my project but can't touch interface builder at all. Didn't change anything ...
GIJOW's user avatar
  • 2,315
8 votes
1 answer
886 views

Any-Any size class ignored for ios7

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 ...
Morrowless's user avatar
  • 6,948
7 votes
2 answers
8k views

Size Classes in iOS 7

I created a new app in Xcode 6 using Size Classes. After testing with iOS 7, I can't figure out how to get iPhone to display a certain size class while in landscape mode. I first developed the UI ...
Kurt Anderson's user avatar
7 votes
3 answers
3k views

Decreasing Storyboard compiling time in Xcode 6

I converted my storyboard from old project with about 30 scenes to Size Classes-enabled mode in Xcode 6. After setting constraints for at least one scene I am trying to compile project and Storyboard ...
Olex's user avatar
  • 1,656
7 votes
1 answer
1k views

Storyboards + Size Classes: How to implement different Segues, ViewControllers, UserFlow for different devices / size classes?

an existing iOS 7+ app supports iPhone and iPad. Currently I am using two different Storyboards for iPhone and iPad layout which works fine. Now I am trying to convert this to a One-Storyboard-Layout ...
Andrei Herford's user avatar
6 votes
3 answers
3k views

How to fix missing/conflicting Constraints for wAny hAny when using different Size Classes

What I am trying to achieve I want to have two views of equal height arranged vertically for all Regular Heights. However, for Compact Heights I want to have the views arranged horizontally. This is ...
Suragch's user avatar
  • 498k
6 votes
1 answer
1k views

Xcode 8 Vary Traits with autolayout issue

Ok I've finally taken the plunge into autolayout using Xcode 8. I might conceptually have the wrong idea. However I have a view in IB which has 2 labels a button and an imageview dead center in the ...
Alex McPherson's user avatar
6 votes
1 answer
4k views

What's the difference between "Regular Height" and "Any Height" in Compact Width in Size Classes?

In Compact Width, NSLayoutConstraints declared in Any Height have the the same effect of the ones applied to the Regular Height class. What are the differences between those classes?
Cesare's user avatar
  • 9,269
6 votes
1 answer
648 views

Size Class compact height doesn't work properly with UIStackView's axis and real device

This is how it looks like in my storyboard and Preview: And this is what I set up in storyboard for that UIStackView: But everything changes when I run this on real device: Why it happens like that?...
Bartłomiej Semańczyk's user avatar
6 votes
1 answer
360 views

Wrong Size-Class of UIViewController shown with UIPopoverController

I am working on universal iPhone/iPad application with universal storyboard. For some ViewControllers I'm using size classes if they has some specific layout on iPad. I have one ViewController that ...
tiko's user avatar
  • 61
6 votes
2 answers
1k views

IOS 7.1, Regular width constraints on universal storyboard ignored if Target device family set to iPad

I started a new single view project on Xcode 6.1 went to my target and set Device Family to Universal and Deployment target to 7.1 In the storyboard i placed a red label in Size class Regular Width | ...
MichaelB's user avatar
  • 1,352
5 votes
3 answers
3k views

UITextView Font size class not change

I try to set font size class of UITextView in storyboard, but it always shows system font (default font, size and color). It shows the correct font if I don't set font size class. Here's a screenshot:...
zixsma's user avatar
  • 51
5 votes
1 answer
6k views

UITraitCollection Clarification

I'm trying to figure out how to use UITraitCollection programatically, but I find it difficult to make sense of it. I'm developing for an iPad retina, in iOS 8. println(self.traitCollection) returns ...
Chris's user avatar
  • 7,990
5 votes
1 answer
770 views

Adaptive layout for iPad

I am following this article for building adaptive layout in ios Building Adaptive User Interfaces for iOS 8. It will work fine on iPhones . Now i wan't to give the same effect on iPad. But for iPad ...
Rizwan Shaikh's user avatar
5 votes
1 answer
5k views

What is the difference between Top and TopMargin in NSLayoutAttribute?

I am trying to create a constraint via code: constraintImageCharacterTop = NSLayoutConstraint (item: image, attribute: NSLayoutAttribute.Top, relatedBy: NSLayoutRelation.Equal, ...
Cesare's user avatar
  • 9,269
5 votes
3 answers
2k views

XCode 6 - iOS 8: programmatically check if view is installed

I am using class sizes in interface builder, defining slightly different designs for different sizes. One of my view is not installed for a specific size. That works as expected, but now I would like ...
JP Hribovsek's user avatar
  • 6,707

1
2 3 4 5
11