Why doesn't Interface Builder objects shows up on screen? - ios

I've never had any problem with Interface Builder elements before (labels, sliders, switches etc), but suddenly I can't get new ones to show up in the app!
I can drag them in to the view, arrange them as I want, set values etc, but when I run the code they are gone.
A mysterious thing is that I can set values to them in the code without problem, like:
self.myNewLabel.text = #"test"
And if I stop the code with a breakpoint and ask the console
po self.myNewLabel.text it gives me "test"
But still, nothing shows up on the screen!
I've searched for any hidden or alpha properties that was set by misstake, but found nothing.
What are the pitfalls here? What am I missing?
System Info:
Xcode 6.1
OSX 10.10
Running on iOS 8.0 device

Check the constraints created by Interface Builder - they may be inadvertently pushing your UI elements off-screen.

Related

Swift - Strange text rendering at runtime

I am working on an iOS app right now. I usually use the Interface Builder and recently it has been producing an issue. When the storyboard is seen in Xcode the labels on everything look fine, but some UI elements don't render properly at runtime. This has also happened for some of the images in this project. The only font used is the system font.
I have tried readjusting the font and using attributed text, but this hasn't worked for the specific label shown. Just to mention, this app is a shared project through Git so it may be an issue with it pulling incorrectly or something, but that seems odd for it to affect the text after it has been changed and adjusted.
View post on imgur.com
The results should be crystal clear text on iOS, but it results in "fuzzy" text you would expect if you were running the Windows XP on a 480p screen. What could be causing this issue?
It seems like the layer of a superview of the UILabel in the provided image is set to pre-render. This is good for performance reasons but may not always look as good, as is seen here.
If you're setting a custom layer on a superview of the UILabel, try setting the layer's shouldRasterize to false.
Ex: exampleLayer.shouldRasterize = false

Objects not showing up in simulator

I havenĀ“t had any issues with this before but when i drag and drop any object into a viewcontroller it does not show up in the simulator but if i create it programmatically it works. I tried restarting Xcode, clearing Auto layout and uninstalled the app from the simulator without any success.
Is there some sort of global setting to i might have touched like not enabling Auto Layout? I also checked the view hierachy and saw that the object was not there, however when i took a look in preview it was there.
Make sure that you set the constraints correctly. To see if there is an underlying problem with the simulator, place an object in the upper left-hand corner of the View Controller, clean (Command - Shift - K) and run (Command - R) your project.

Autolayout yellow warnings. Will it crash my app in run time

In storyboard , I am seeing a lot of yellow warning. Upon clicking the yellow warning , I get like update frame or update constraints. In the console it throws auto-layout warnings too. I just want to know whether it will crash my app because of this.enter image description here
Yellow warnings and auto-layout warnings in console are not related.
Yellow warnings means that what you see in IB is not what you will get at runtime according to current constraints. If you want to see what you will get you should click yellow warning and press "update frame". If you want to get at runtime what you currently see in IB you should press yellow warning and select "update constraint".
Runtime warnings in console means some constraints conflict at runtime. You should analyse the warning message to find what is the issue.
Most of the time it will not. But I suggest you to fix them all.
why not update all the frames, the difference Xcode complains about is not much, and NO it wont crash your application, BUT Xcode complains as there might be situations where your constraints wont work as per you set them.
Your Application will not crash weather it is a Yellow one or a Red one .
Xcode only means that the constrains you have kept may not work properly in different modes and resolutions .
You can simply fix it by simply clicking on update constraints,but result may not be what you expected.
So click on yellow arrow and read suggestion by xcode.

Xcode crash on opening storyboard

I am developing an app for iOS with Xamarin. Lately, I haven't been able to access my storyboard file in Xcode or compile my app anymore because Xcode crashes right away when opening the .storyboard file.
The error message is the following:
ASSERTION FAILURE <br>
Details: Creating an out of band arbitration unit with a view (<IBUITableViewCell: 0x7fa88d13a5d0>) as the root under another view (<IBUITableView: 0x7fa88cf000e0>) is not yet implemented.<br>The view would need to be in two arbitration units, the one above for positioning constraints, and the root of the one below for sizing constraints. <br>But then that means that subviews cannot have constraints that affect the size of the view, so the view must have ibExternalTranslatesAutoresizingMaskIntoConstraints set to YES.
<br>Object: <IBUITableViewCell: 0x7fa88d13a5d0>
<br>Method: -ibArbitrationUnitWasCreatedWithReceiverAsRootUnderParent:
I tried rebasing my storyboard to the last version that worked (the one the app was submitted to the app store) and weirdly, even that version didn't work.
My plan was to manually remove and every view controller and add them one by one to figure out where the error is.
However I don't understand why XCode crashes when opening the storyboard and not just shows me exactly where the error in my xml is.
So if anyone has encountered this problem before and has a better way to fix it than to manually do it, I would really appreciate any help.
ibExternalTranslatesAutoresizingMaskIntoConstraints needs to be YES
Sounds like the Storyboard was created with an older Xamarin.iOS that introduce this issue.
The fastest solution is to open the storyboard in vi (or Xcode / View As Source, or another text editor of your choice, and replace all translatesAutoresizingMaskIntoConstraints="NO" with "".
Save the file, re-open it in the Storyboard editor and fix your contraints.

why storyboard ui elements not showing on UIViewController in xcode 6?

I am new to IOS development. I am developing an app for IOS 8 devices. I used storyboard for my design yesterday my storyboard showing all UI design but today morning it show blank UIViewController no UI element vision please see in screen shot and very strange thing is that when i run my app all ui element visible in my device. I google but dont find any solution please help me out. Thank you in advance.
It looks to me like you are using size class and you went into a particular size class and added these views. Now you are back in Any size class, so the views are not there (that is why they are greyed out in the document outline at the left). They are available only for that particular size class. If you switch back to it again, whatever it was, you will see them again. Basically, you have created conditional views - the condition being that they are present only when that particular size class situation is the case.
In other words, if you want your layout to apply in the general case, you want to start by creating and editing it under Any size classes. Only then do you switch to a particular size class and modify the layout for that particular size class.
when i run my app all ui element visible in my device
Yes, because on your device the particular size class situation matches the size class you were editing when you added those views. So there they are. That seems to me to prove my guess is right.
I have the same issue while copy a ViewController to another storyboard.
Fixed by following steps:
1: Select the viewController
2: Click on 5th Tab
3: Set the simulated size to Fixed.
Select install:
Since all components [like label,textfield,buttons] are in disable mode, one select Installed check mark its will be enable again adjust constrain accordingly.
The size must be the same, in all xcode storyboard
In my case, it was due to me setting alpha to 0.0 and forgetting it.

Resources