Xcode 6 beta 4 Size Classes not good size - view

I want to use the new tech of apple, the Size Classes, but i don't understand why when i select the iphone size, my view have a width of 400p while my iphone have a width of 320p.
Anybody have an idéa ?
Thank

You should watch the WWDC video on developing adaptive apps. Basically, an iphone in portrait has Regular height and compact width size class. This has nothing to do with the real pixel dimension, since Apple might introduce a new phone that's 350pt wide, but still has the same size classes, so your code would work.
Watch the WWDC session video, and use size-classes together with auto-layout to make your apps.

Related

Set object properties depending on Size Class in iOS8

I am new to iOS development, I have read about size classes, I have a question about setting properties (or just calling methods with some parameter) depending on ViewController's size class. I am developing a simple radio app, for app design I decided to use Collection View in which I want display logo image. Because I develop universal app and I want to place images in 3 columns or rows on both iPhone snd iPad versions, I need 4 Collection Views for iPhone and iPad for portrait and landscape orientations. For example for iPhone's Collection View I set 75x75 image size for cell, for iPad's 200x200. So for one object (radio station) I need to create 2 image sets, because I do not want just to use the biggest iPad's images on iPhone for two reasons: higher CPU usage, scale issues.
So question is which is the best solution to create objects in array for Collection View with appropriate image size depending on Size Class? Is it good solution to use UITraitCollection to determine Size Class in the viewDidLoad method?
You question indicates you need first to take time to learn some stuff on iOS.
Like you I had to start and learn : it is no problem.
have a closer to auto layoutin iOS
www.raywenderlich.com
then see how easy and fun is iOS development (just need to practice to understand how easy it is). Here is a tutorial for collection views:
www.raywenderlich.com
image scaled
in your image asset
place image with name terminated with
nothing, #2x, 3x
-> easy way to scale image : I use sketch.

Get iPhone 5s app to scale to iPhone 6 resolution in Xcode Storyboard

I want my iPhone 5s app to simply upscale for the iPhone 6. I have no Launch Images in the project, but I do have the interface builder location declared in the plist to get rid of the black bars. How can I get the app to just upscale, right now it shows white space in Storyboard.
Looking at your question it looks like you are using absolute frame values for positioning, by setting frame.size.{width, height} and frame.origin.{x,y}.
You have two options.
set those values programatically. It's not recommended at all but might be easier to setup. Detect what is the screen's size with [[[UIScreen mainScreen] bounds] size] (check for the height property) or detect the device's version (eg Determine device (iPhone, iPod Touch) with iPhone SDK).
a less slippery road is to transform your project an start using AutoLayout. There's a learning curve but it guarantees that your project will be fitting well any screen. Start here: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html

Conditionally allow rotation on iOS 8

On iOS 8, apps like Weather and Clock rotate on the iPhone 6 Plus but not on the smaller-screened iPhone 5S. I can override supportedInterfaceOrientations but is there a better way to detect the 6 Plus screen other than specific checks like screen bounds or device model?
I looked into size classes, but couldn’t find a way to detect if a device returns UIUserInterfaceSizeClassRegular on Landscape orientation before the device is actually rotated.
I'm supporting iOS 7 too so I've stuck with checking the screen scale > 2 but if you are on iOS 8 you can use the trait collection. The 6+ in landscape is "regular" width while other iPhones are "compact" width.
See the Apple What's New doc for more info

Xcode 6 – Unified storyboard & Size Classes

How does auto-layout work to create interfaces in Xcode 6 beta? What are different size classes & how do they work? How to use the "Resizable Unified Storyboard" to create universal iOS app?
I think you are talking about "Size Classes" introduced in XCode6.
A size class is a new technology used by iOS to allow you to custom your app for a given device class, based on its orientation and screen size.
There are presently four size classes.
At any time your device is going to have a horizontal size class and a vertical size class.
You don't need to worry about device size. Whether it is iPhone 4s, 5 or mighty iPhone 6. UI would be handled automatically for you...
For more info read this article.
See this WWDC Video for more clarity..Building Adaptive Apps with UIKit
With that new feature only aspect ratios are defined. Click at the button "blue" area and you will see the description for the aspect:
wAny hRegular -> For all regular height layouts (e.g. iPhones in portrait, and iPads in portrait or landscape)

Scale images and buttons of layout in Xcode

How can I stretch the height of buttons and images in Xcode 4.6.3 in Storyboard?
I have a simple navigation with some images and a few navigations buttons as per the images below. In the first image its displayed on iPhone 4 and on image 2 its on iPhone 5. As you can see the buttons are now looking a bit lost on the bigger display.
Can I stretch the buttons' height for the iPhone 5 in Storyboard? I have seen examples of using Autolayout but they all seem to do with orientation (switching from portrait to landscape).
Can what I need to do be done with Struts and Springs perhaps? I am unable to test at the moment as I only have access to Xcode once a week. Just want to have as much information for the next time I get to work on project.
iPhone 4 display
iPhone 5 display
that's actually really easy to awnser! Just use autosizing. Here is what you need to do:
Xcode 4.5: How do I fix my text views so they display properly in portrait and landscape mode on an iPad?
Just play around with the inner cross and see what happens. You need to set the autosizing for every button if you want to resize them all.
Have a good one,
Noah

Resources