size-classes

UIView autorotation issue

烈酒焚心 提交于 2019-12-02 12:50:05
I am getting issues in autorotation of a UIView which is nothing but a red line of width 4 and height half of superview's height in landscape mode, and in portrait mode the height is 4 points and width is half of superview width. You can see the issue in the gif. As I rotate from landscape to portrait, the effect of autorotation is not smooth and with distortions. Here is the code. What am I doing wrong? private var myView:UIView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. myView = UIView(frame: CGRect(x: 0, y: 0,

Use Xcode Auto Layout for different image sizes on iPhone

混江龙づ霸主 提交于 2019-12-02 11:36:17
With Auto Layout for iPhones in Portrait, I don't want the exact same size UIImageViews for game characters on iPhone 6+ as in iPhone 4S. The 4S characters need to be smaller or else they'll look too big. Using Auto Layout how do I change image sizes between iPhones because they seem like they all change to be the same sizes regardless of constraints. I am sure that they would be smaller because when you add images, you add 3 sizes of the image: @1x, @2x, and @3x. These images make the image universal for all Apple devices. Try them out in your simulator. 来源: https://stackoverflow.com

UITraitCollection Clarification

做~自己de王妃 提交于 2019-11-30 10:05:05
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 the following output: <UITraitCollection: 0x10df4c7f0; _UITraitNameUserInterfaceIdiom = Pad, _UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Regular, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1> Which is pretty straight forward. But when I then rotate the screen, I get the exact same output. I.e., same vertical size

Size Classes in iOS 7

拈花ヽ惹草 提交于 2019-11-30 07:31:37
问题 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 with iPhone landscape as wAny hCompact, but iOS 7 doesn't recognize that. I had iPhone portrait in wAny hAny. I then changed it so now I'm using wCompact hRegular for iPhone portrait. I then modified wAny hAny to be the landscape layout. But it's not using that layout when the iOS 7 device is in

iOS- Detect current size classes on viewDidLoad

余生长醉 提交于 2019-11-30 06:22:02
问题 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? 回答1: As of iOS 8 UIViewController adopts the UITraitEnvironment protocol. This protocol declares a property named traitCollection which is of type UITraitCollection . You can therefor access the traitCollection property simply by using self.traitCollection UITraitCollection has two properties that you want to access named horizontalSizeClass and

iPad Landscape and Portrait different layouts with Size Class

最后都变了- 提交于 2019-11-29 16:53:03
问题 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 in portrait and horizontally in landscape using Size Class 回答1: Finally I found a solution : if traitCollection.verticalSizeClass == .Regular && traitCollection.horizontalSizeClass == .Regular { var orientation:UIInterfaceOrientation = UIApplication.sharedApplication().statusBarOrientation; if

What constraints should be given to increase size of imageview with respect to device screen size without reducing image clarity

房东的猫 提交于 2019-11-29 12:34:18
I have to show an imageview in a universal app ans it's size should increase as the screen design in every devices without reducing image quality. The image given to the imageview is a static image. If I use static width and height constraints using size classes it will work. But I don't think it as the correct way. If i use width & height Proportional to the superview, it increases the image height but image clarity reduced in ipads. Any suggestion will be helpfull. To make Imageviewsize respect to device for universal application , you need to give correct multipler to imageview. please

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

倖福魔咒の 提交于 2019-11-29 05:29:54
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 inches, just the iPhone 4S, at the same time I don't want to left out this device. There's any workaround so I can set the amendments but just and only for the 3.5 inches portrait? or should I say goodbye to 100 millions devices out there? I know it's a tough question and almost an opinion poll, but technically speaking I would like to find my best way

iOS- Detect current size classes on viewDidLoad

笑着哭i 提交于 2019-11-28 17:28:43
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? As of iOS 8 UIViewController adopts the UITraitEnvironment protocol. This protocol declares a property named traitCollection which is of type UITraitCollection . You can therefor access the traitCollection property simply by using self.traitCollection UITraitCollection has two properties that you want to access named horizontalSizeClass and verticalSizeClass Accessing these properties return an NSInteger . The enum that defines the returned values is declared in

What constraints should be given to increase size of imageview with respect to device screen size without reducing image clarity

时光毁灭记忆、已成空白 提交于 2019-11-28 06:14:59
问题 I have to show an imageview in a universal app ans it's size should increase as the screen design in every devices without reducing image quality. The image given to the imageview is a static image. If I use static width and height constraints using size classes it will work. But I don't think it as the correct way. If i use width & height Proportional to the superview, it increases the image height but image clarity reduced in ipads. Any suggestion will be helpfull. 回答1: To make