FAQ Database Discussion Community

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 the frame is perfectly square, and when the device is rotated to landscape the buttons...

Swift - Make layout smaller for one device

So I don't get the point to develop for 3,5 devices if the layout view is bigger than that, now some of the layouts doesn't fit in the 3.5 devices, what is the best way to solve it, I am already using Size Classes and Auto Layout. Is there any...

Will constraints set up in code override constraints created using AutoLayout and SizeClasses?

I set up a constraint this way: constraintButtonUpgrade = NSLayoutConstraint (item: buttonUpgrade, attribute: NSLayoutAttribute.Bottom, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.Bottom, multiplier: 1, constant: 500) self.view.addConstraint(constraintButtonUpgrade) Will this code modify the constant of the same constraint (with the same item, attribute, toItem that I created in the Storyboard view?...

How to get CAShapeLayer() circle to resize based on the size class

I'm trying to create a circle using CGPoint and CGFloat. But I want the circle to be different in siz based on which device is used. I changed all my Size classes to reflect the sizes I want and I was hoping, it would recognise that but it doesn't. WhiteBar...

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?

Most efficient way to reference 2 different IBOutlets at once (where each one only exists for it's own size class)?

I am currently using unified storyboards (with size classes). For 1 of my views, the difference in design between the wAny hAny and the wRegular hRegular size classes is significant enough that altering the constraints for the subviews based on size class is not enough. A simplified example: I have...

How to set layout constraints for variable hight calculated at run time?

I have a UIView with 3 UIViews as its subviews. I have set layout constraints for these subview as fixed aspect ratio. i.e if the screen size changes their width will change but aspect ratio will always be the same. Now i have also made width of the UIView (the...

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

I made a special test app for this case. I added a view on my controller's view in Storyboard, set up AutoLayout constraints in Interface Builder and made one of them (vertical space) is defferent for different size classes. Screenshot from IB So the value is 100 for Any height,...

UICollectionView change flow direction on rotation

Hey, I'd like to obtain what you see in the pictures: in Compact Height mode (landscape iphone) both the red and the blue view have to take all screen vertically and half the screen horizontally. In Compact Width mode (portrait iphone)they have to take all the screen horizontally and...

How do I prevent my UISplitViewController from displaying the master VC when rotating to portrait?

I have a UISplitViewController that is used to edit some text. The flow is basically like this: The user creates a new note. The user is transitioned to the Detail View Controller to create or edit said note. User can edit the text in either portrait or landscape. The problem...

Is it possible to use size classes to adjust the text size for UISegmentedControl objects?

My app doesn't look good on large screens. On my main screen, I use a segmented control and on an iPad (Mini), it looks unprofessional, because the text size doesn't scale up in these segmented controls. The segmented control itself is easy enough to enlarge by setting constraints tying it...

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, toItem: self.view, attribute: NSLayoutAttribute.Top, multiplier: 1, constant: viewTop) self.view.addConstraint(constraintImageCharacterTop) However, I am not sure which is the right NSLayoutAttribute for this constraint. image should have a top space to the main Superview...

Size Class Initially Unknown

I am trying to setup my UI on my universal app. I have a storyboard setup with size classes, a fairly simple UI. I have my view controller with a view in. Inside this view, I draw a chart so this can only be updated using setFrame. This is where...

Different UIs using size classes on iOS

As we know we can use size classes in conjunction with auto layout on iOS 8 to build a universal app/UI for all the iOS supported devices. Thats awesome. But my concern is if the UI itself differs, i.e there are different UI components to do the same task on...

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 to modify the layout for all iPhones under 4.7,...

How use adaptive size classes to determine which segue to use?

I've been trying to determine which segue to use (depending on the current device) using adaptive size classes rather than to use userInterfaceIdiom in code. I saw this mentioned here but don't understand how to do it.

Unexpected behavior of systemLayoutSizeFittingSize: and size classes

I've got some strange problem related to dynamically sized cells, auto layout and size classes. My test project is completely based on Ray's tutorial. It seems that the only difference is UILabels's font sizes for size classes. The height calculation is wrong when I set another font size for...

Size-classes and constraints with buttons

I hope someone can help here as I've been reading and watching a lot about size classes as I've just started work on first app using size classes.I thought I'd got the idea but having a slight issue. I've got a view with 10 buttons in it. I want the...

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 adaptive layout is not work. Here is screenshot of application in iPhone5...

UICollectionViewCell AutoLayout dynamic height based on UILabel

I am using auto layout and size classes with UICollectionViewCell. So the idea is to make an UI similar with Instagram. The problem is that i can't fully understand how to add a proper autolayout because it seems add missing constraint didn't do the things magically. when I add constraints,...

Change the sizes in portrait mode for iPhone 6 and iPhone 6 plus

Size classes : compact width any height for all compact width layout (all phones except iPhone 6 plus) compact width regular height for all iphone in potrait any width compact height for all iphone in landscape (except iphone 6 plus) regular width compact height (for iPhone 6 plus) iphone 6...