xcode 8 live preview not previewing properly - swift

I have updated xcode to the last version (V8.0). In the previous stable version, the live preview sections shows the app exactly how it would be in the device. However, in the new version, the live preview sections shows the app exactly how it appears into interface builder.
how can I have the live preview as it was before?
Any idea will be appreciated.
Thanks in advance.

The Interface Builder of Xcode 8 has been thoroughly reengineered. It is not possible to set it back to the Interface Builder of Xcode 7.
You have two options.
Either you download Xcode 7.3.1 from the Apple developer center. But you'll lose the ability to use Swift 3. This option is absolutely not recommended since you'll also lose future updates and future new features.
Or you make yourself familiar with the new Interface Builder. That option is recommended. The Apple promotion tells you exactly why:
See a live preview of exactly how your app will appear on any Apple
device with full vibrancy. As you quickly switch between different
devices to customize your UI for size classes, you will always see the
same interface as your customers. Pan and zoom are incredibly fast,
and you can even edit your interfaces when fully zoomed out for a
bird's eye view of your storyboard.
A Beginner’s Guide to Auto Layout with Xcode 8
Also I can advise you to look at this thread. I had issues with the new Interface Builder as well. The key answer: Split big Storyboard into many small ones. And update the Constraints from Xcode 7 projects as suggested in the answer:
1) Remove only one of the "Height equals: xx" constraint from one of your views inside the cell.
2) Update all frames.
3) Select the view you removed constraint from.
4) Click to add new constraint button. Now it should be showing a new height, probably with a decimal value.
5) Add height constraint without changing the value inside the box.
But splitting my Storyboard into many smaller ones did the trick. Take a Storyboard for every scene of your App. Like Login. Tweets. Pictures. Settings.

In Xcode 8, preview is by default attached at bottom side of view editor,
Here is the screenshot of the bottom view, which gives you the preview,
Select Any of the size shown to preview it in respective size.

Related

Cocoa graphical glitches

I added a Safari tab-like system to my Cocoa application and since, I got some serious graphical glitches. I implemented the tab system in Auto Layout, simply with buttons on a horizontal stack view with another tabless tab view, nothing special.
I started with something looking like this:
to issues like blank labels and the search field color and font are weird.
There are no errors in the console, just graphical glitches. The constraints looks okay, the keyboard and mouse events are working well as well, nothing seems to be broken other than the render.
The "Debug View Hierarchy" does not seems to have the same issue than in Runtime:
I looked around for similar graphical glitches, but could not found anything.
My app is in Swift 4.0, I am using the last stable XCode and OS X version.
I don't know where to look. I am looking for some tips to help me debug this! Thanks!
I found the problem, it was because I had a Visual Effect View with the "Vibrant Dark" effect, then the tab view were created from a custom view controller which was inheriting the Aqua apparence by default. The mix of the two apparences seems to be the cause of the graphical issues and it explained why default apparence inheritance was not an issue until I implemented my tab system which broke the main view into a separated view controller. Such a weird Cocoa display issue...

Swift Storyboard Auto Size Classes

i have a problem. I had a storyboard in Xcode 6 with the inferred size of the view controller and the "Use Auto layout" option checked. Today i wanted to use the new " Use Size Classes" option. I checked the option and then in the simulator the screen was all black!
EDIT
now that i resolved this issue i have another thing here ! I use "Add missing costraints" option to have a resize for all Apple Device, the Tab bar and navigation bar are good, but then all the buttons ( they have an image ) are in different position !
How i can resolve that ? Thanks in advance.
A black view.. if not always, is a good indicative that the view is not loaded. Size Classes introduces a new concept ...You can have several views that will be installed or not into your view depending of your view configuration. More details on images below:
This is what you will be looking for:
This is what I call view rendering configuration (sure Apple has another name for it). It is located at center bottom of your storyboard view.
This is always located at the end of Attributes Inspector tab:
Make sure it is enabled for the view that suits your testing device.
I found out that the ViewController wasn't set as Initial Controller.
You should avoid as possible the use of "add missing constrains". Is an automatic tool that almost always ends up adding unnecessary constrains or breaking others.
If you want something to look really good an stable, sadly there are no shortcuts... you will eventually end having to do it all by yourself.

UIButton not showing the text in iOS6

I am working with iOS6 and Xcode 4.5, I am getting an UI issue with some UIButton, some of the buttons title are not getting shown in my view.
In an older version of iOS everything works as expected.
Please see the following image. It's not showing the text "Button" while executing it on simulator
I had a similar case which I just resolved. I think I know what triggers the issue with auto-layout.
I assume that you have created one button, then copied across the row and then copied the rows down. When you do that, one of the auto-layout constraints that's set is "Baseline alignment" between the buttons.
The problem is if this constraints (it does not have to be user-level) remains between buttons which are not on the same horizontal position, meaning between buttons in different rows. So select the problematic button and check to see if you have this constraint. This was my case:
If you do, select it, upgrade to user-defined and delete it. All magically works afterwards.
1Finally i solved my issue , actually iOS6 makes a default auto layout for view controller , through that it will align each component in the view .while i dont need the auto layout .
so i just uncheck the auto layout in property which solved my issue .
clean your project and build again, if not work then restart the xcode and remove the old app from the simulator.
one thing more, if nothing work for you then remove the button and add new buttons.
Try changing the "line break" property of the button to anything other than truncate middle. It looks like it's being truncated to just an ellipsis.

is there a way to update size of button through interface builder?

I want my buttons twice as big when iPhone 5 launches on screen, is there a way to do this using the interface builder? Or do I have to do this pragmatically?
I don't think there is such a solution in Interface Builder. Pragmatically is the option for you.
But why do you need it?
EDIT:
You can manage spacing by View submenu in Show and Size Inspector (Option / Alt-Command-5). See Autosizing and example windows next to it.
Here are Apple's docs regarding this topic (point 8.f): Xcode Quick Start Guide - UI

iOS 4 - How to add table view to a tab bar application

I am new to iPhone programming and am having a really hard time trying to figure out how to add a table view to a tab bar application. There are not many tutorials on this for iOS SDK 4 and the Apple documentation is very light on details. Since I am new I would really like some tutorial that has screenshots (or at least clear instructions) when it comes to things being done in Interface Builder (like making connections between the objects and File Owner, etc), usually lot of tutorials/blogs gloss out these details.
What I am trying to do is create a tab bar based application with 3 tabs (this I am able to do). The first tab needs to display a table view with the header having 2 buttons (one on right and other on left, with the title in middle).The title is actually today's date, obtained from the phone. Clicking either of the header buttons should take you to another table and the title should be yesterday's date (if left button is clicked) and tomorrow's date if right button is clicked.
Can some one please suggest me a good tutorial for this. I am thoroughly confused by the Interface Builder (especially how to create connections).
The only page I remember frequenting on the past, is CocoaDevCentral.
Personally, I learnt how to use Xcode through video tutorials, so I recommend you to start searching there. Also, to help you with your search, always look for the full name of the objects involved, for example: instead of searching for "tableView", look for "UITableView", apple's notation is very particular and helps narrowing down the result.
Finally, ignore the nay-sayers about Interface Builder, you should give it a try, and see if it fits your style. For instance, I like being able to get a look at the overall design, as I usually help with the design.