Using Spring/Strut AND AutoLayout (Xcode 8) - xcode

All the topics i saw here was one vs another.
My question is:
It is possible to use Autolayout AND spring and struts effectively? If you don't set any constrains to the object you'll see that you still have the old spring and strut interface on the Size Inspector tab.
The problem is, im doing a test App for iPhone only and to be honest spring and struts works like a charm for 90% of the cases (even if the width/height ratio is different like iPhone 4).
But for the 10% constrains is needed to get the results i want. (Table Views, dynamic text and so on).
I couldn't find anything to see if Apple is still maintaining struts and springs (they must have since you can still use them) but i know Auto Layout is a improved version of spring and struts and Apple focus is Auto Layout.
Of course a 100% Auto Layout approach would be the best option but for setting simple things like a button i don't know why isn't spring / strut a viable solution. (Considering you are not doing a iPhone and iPad app)
So, it is possible to use both or i'll have problems in the future? (Considering im doing an App JUST for iPhone or iPad, never both)

It is possible to use Autolayout AND spring and struts effectively
Yes, absolutely. This has always been true if your views are created in code. But starting in Xcode 8 you can also do it in Interface Builder, i.e. you can combine the two in the same nib (xib/storyboard).

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".

coding without storyboards

I am following a tutorial video on how to allow users to edit their profile. In this tutorial, they are using storyboards and I am not. I was wondering, do I have to use storyboards in order to follow along? Or can I use their code to plug into mine without the storyboard?
According to Apple documentation:
A storyboard is a visual representation of the user interface of an
iOS application, showing screens of content and the connections
between those screens. A storyboard is composed of a sequence of
scenes, each of which represents a view controller and its views;
scenes are connected by segue objects, which represent a transition
between two view controllers.
As you are probably guessing, storyboards contain information about widgets, animations, views that are required by the code you will be adding to yours. Additionally, Storyboards also contain the connection between the visual elements and the code (outlets and actions). All of that can be created programmatically but the code you will be pasting from this tutorial, if it's coming from a project that includes storyboards, won't contain this associated logic.
So, at this point, it would seem highly unwise to add complexity to your tutorial to recreate these elements at once. What I would suggest is for you to follow the tutorial and then try to remove some of these elements and replace them by code to obtain similar results just as an exercise to learn. Keep in mind that Storyboards have been around to simplify the design of UI in the application, so I would recommend for you to master their usage instead of shying away from them.

How to adjust project layout for multiple phones using auto-layout?

I have finalized my project and my mistake was that I left auto-layout to be done at the end, now I'm stucked in it and can't find anyway through to finalize my project.
My project layout was made based on Iphone 7 plus "xcode 8" and has 7 viewcontrollers. when I try to put constraints, the whole project collapse.
Anyone can support with any best practice that can help ?
It doesn't matter what device size you are viewing in xcode. Its default for all size classes. If you want to make different layout for specific size class than you use variations. Check this tutorial https://makeapppie.com/2016/09/05/an-introduction-to-size-classes-for-xcode-8/

Xcode 6 - Swift - Multiple views on a single-window storyboard cocoa app

Just last week I decided to dive into the world of Swift and Xcode development, and as of yesterday I am actively working on a new application. I have a lot of experience with Java Swing, but working with that is obviously a lot different than working with Apple's fancy interface builders and storyboards.
I am trying to develop a single-window application that has many different views that can be navigated by buttons. I tried to wrap my head around the way the storyboard works, but even after all my reading of the documentation I don't know really what I'm doing - I'm so used to working in hard code. It came to the point where I wrote my app's entire network layer just to avoid working with the interface.
Basically I have a set of different NSViewControllers, each with references to a few of their components (buttons, labels, etc) and I want certain buttons to be able to change the current view controller (preferably with a segue animation) to a different one. How can I approach this? I would guess that this isn't hard to achieve, but I am lost. Any help would be appreciated!
Let me know if I need to submit any code - I do have the basic classes written but nothing relating to this.
Thanks,
-Aidan

How to zoom in/out in Xcode 4.1 Interface Builder window to see multiple UIViews

I'm building a xib with multiple views, one oriented for landscape and another for portrait. I'd like to be able to zoom out from the Interface Builder window to see both and then zoom in on one of the views to work on it, rinse, repeat. Can this be done?
This is not possible as far as I know, but Xcode 4.2 allows you to develop your iOS applications using "storyboards", which is similar (and has many other benefits).

Resources