Using storyboard different layouts xcode - outlet dont work - xcode

I am designing layout for iphones and for tablets using the Any * Compact and Regular * Regular of the Xcode story board
The problem is that outlets that i created in the iphones screen dont work in the tablets screens
Its like they are not connected and if i drag and connect them again to code it will work for the new connected layout devices but not on the old ones
How to solve this?

If you use Any Any your outlets and elements on Storyboard will be available to all layouts, when you start qualifying device or layout sizing then the elements on that layout will only be available in that size.

Make all the general configuration that will be same for all screens in Any Any . Then from that configure specific alterations that are needed for Iphones in landscape , portrait and Ipad landscape and portrait respectively

Related

Xcode 9 - How to customize a design in storyboards for just iPhone 5?

I'm using Objective-C and Xcode-9.
When using autolayout, my designs appear perfectly on everything but iPhone 5.
I am trying to see if I can edit my design for -just- iPhone 5/SE screen sizes without affecting my other design integrations.
I tried using "Vary for Traits" but it appears that all iPhone sizes are considered regular height, compact width while in portrait mode so editing the iPhone 5 on those parameters edits all phone sizes.
I think I'm missing something here but I'm not sure the exact keywords to Google.
How do I customize a design in storyboards to be unique for iPhone 5 only, but remain the same for other phone sizes?
There isn't any simple built-in way to design in the storyboard for just one device type/size. But you should not have to. You should be able to make your design work for any phone size through autolayout alone.
Still, if you really can't, just implement viewDidLayoutSubviews (or layoutSubviews in your view controller's main view) and adjust the layout "by hand". That is when autolayout does its work, so if you don't like the results, you can tweak them at this point "manually".

Xcode/Swift Adaptive Layout Issues

I am currently in the process of testing if my app works on both iphone and ipad and setting up the respective autolayout. For some reason on this particular viewcontroller, when I switch from iphone to ipad 9.7 the viewcontroller does not change the height and width of its view resulting in something that looks like this. Also, I am only having issues with this particular storyboard. The rest adjust their views to the correct size like they are supposed to .

iPhone 6(s) plus not scaling new application correctly for some users

I have a brand new Swift 2.0 XCode 7 Storyboard based application.
Target is set to 9.2. I'm currently supporting any device with GPS that can run ios 9.2
I started with the Tabbed View Template and I'm working in wAny and hAny and a single Storyboard.
It works fine in the simulator on a bunch of phones, both orientations and works fine on my 6s plus, 6s, 6 plus and a 5.
But for some users the scaling is wrong and everything comes out squished.
Even in landscape mode the TabBar Icons are very close to each other.
Narrower than even on my 6s plus in portrait.
I believe this is caused by my application not having a Launch bitmap.
My understanding is there are two ways to implement this.
Launcher .XIB/.NIB with half a dozen specific sized bitmaps attached. Or a StoryBoard Launcher with ... exactly what.
The "Or StoryBoard" is a little vague. But I wanted to keep things using the modern approach since this app is new and targeted users tend to have the latest device.
So I created my Launch Image set and tried to attached it to the UIImageView in the Launcher StoryBoard. It won't list items that are tagged as "Launcher Image Set". It will show other Image Sets and Icons. But not the ones specifically for Launcher. It shows an "L" in the xcassets list next to the Launcher Image set. I believe I have the build project setting set correctly and it looks perfect on many of the same exact devices.
After some digging, I read that if you use the "StoryBoard" method you don't need the 6 or so bitmaps anymore. You can put anything in the Storyboard Launcher View and treat it just like you would treat your main storyboard.
So I did that. I just centered a small image.png file in the View of the Launchers Storyboard. Works on all simulations and my iPhone 6s plus. I did not pin it to the edges because that would mess up the aspect ratio of the image.
A very small set of users still have the issue and one of them even uninstalled and reinstalled.
I tried playing with setting phone Zoomed, Normal, Text Size, Bold etc. They all work. Users also don't have anything out of the ordinary on these system settings.
So first, do I need the 6 proper sized bitmaps or not? I read conflicting info on this.
If I want to use the 6 images on a storyboard how to I get them in the UIImageView of the Launcher StoryBoard if they won't list? Should I put them in a regular image set. Does the "Launcher Image Set" only work for the for the Launcher.XIB?
If it's not the Launcher window, what else could it be causing this?
I know I could create a XIB/NIB with the 6 bitmaps. But that seems like I'm going backwards and I don't care about old OS versions or older phones.
I think I found my answer. When using a Storyboard Launcher you cannot use a "Launch Image Set" for your Launcher Storyboard. You have to use an Image Set.
This is the best Video I found that covers it A-Z.
https://www.youtube.com/watch?v=Vz6tCgXgZFo
It also didn't fix my initial problem. Which I'll post separately. It scales correct in Portrait but not in Landscape for hand full of users. Using the same hardware as others that it works fine on.

Swift - Problems with layout

I have a Universal application in Swift 2.0 developed in XCode 7.
On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'.
When I run the application on my device (iPhone 5s), none of the labels are aligned and the toolbar is out of view. -This is also the case when I run using the iPad device in XCodes simulator.
Image of what the view controller contains ...
From the snippet above, when I run this VC on my iPhone there is no margin on the right side, and the toolbar is cropped off.
Can anyone advise how I can make a universal application show all the content in the VC, on all devices. Or how I would simply show the toolbar ...
That's what auto layout (constraints) is for.
On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'.
That's irrelevant, and indeed misleading, since in means that only on the iPhone 4.7-inch will your app look like the storyboard design — unless you use auto layout.
iPhones come in many screen sizes. Basically, you have no way of knowing, as you design, what the screen size will actually be! Auto layout is the solution. Auto layout allows your interface elements to adjust automatically as the app launches on a particular size screen. iPads can serve as an extension of this — i.e., just an even larger size screen — or you can even use conditional constraints to make the interface quite different on the iPad from the iPhone, if desired - all designed in a single storyboard.
Maybe you are using auto layout and auto constraint. You could deactivate this in opening the storyboard, open up right panel , go to "show the file inspector" section and under Interface Builder Document uncheck auto layout and auto constraint
Image here
Select your item view, go into "Show the size inspector" and there you can set your autoresizing for all devices

XCode6 Autoresizing

I always tested my iOS app with (written in swift) with iPhone 6 simulator. Now I realized, that it does not automatically resize in other simulators like iPad (layout is small in the left edge) or iPhone 4s (layout is too big and cutted). I tried disabling Auto-Layout but even when I enable it again it doesn't work. What is the best way to make it resize ?
Designing for multiple screen sizes is a fundamental part of the development process and therefore you can't enable auto-layout and expect it to work the way you want.
You know that the iPhone 4S has much less screen space than the iPhone 6 Plus, so at a minimum you need to add Auto Layout constraints to your views so that they scale and position appropriately. Sometimes you might want to change or move entire UI elements for compact and regular screen sizes.
See the Apple Auto Layout guide for examples.

Resources