Interface Builder can't set accessibility traits (Xcode 8) - ios

I am having a weird problem in Interface Builder (Xcode 8). Basically, I can't enable (select) accessibility traits; IB is rejecting my attempt.
For example, I have a UILabel which has the "static text" and "user interaction enabled" traits enabled. I can click the "static text" checkbox to disable it. But then when I click it again to re-enable it, the checkbox briefly shows a minus ("-") which then disappears, leaving the checkbox unchecked.
I don't know how to re-enable that checkbox (or any other). Any solutions would be appreciated!

This has happened to me once. Try restarting Xcode.

This was a bug introduced in Xcode 8, that affected inspector properties that map to bit mask properties. This includes iOS accessibility attributes, NSWindow style masks, and popover segue directions.
https://twitter.com/eternalstorms/status/776384102291431424
It's fixed in Xcode 8.3.

I still find the bug in xcode 8 (do they even fix them?) and when i restart xcode i'm able to set one or two of these traits, then the bug reappear...
One way to deal with it is to edit the file "as source code":
in the Project navigator panel right click on the xib file and "Open as -> Source code"
find the block "

Related

What does the "automatically adjusts font requires using a dynamic type text style" warning mean?

I am getting the following warning:
"automatically adjusts font requires using a dynamic type text style"
Which I can not get rid of the warning is on main.storyboard.
I have checked every UILabel in the Identity Inspector to make sure the "Automatically Adjusts Font" is unchecked.
Open your storyboard as Source Code
Search for key "adjustsFontForContentSizeCategory"
Check which object has this option and uncheck Dynamic Type checkbox from interface builder.
I just changed Text style to Body & Warning vanishes.
It's Just because
it is dynamic type textStyle
See list of predefined supported dynamic type textStyle -
I had the same problem. Even after I opened the storyboard as source and removed the "adjustsFontForContentSizeCategory" key, saved and cleaned the project it would still show.
So then I:
Cleaned the project
Closed Xcode
Deleted the derived data folder contents
Re-Opened Xcode and rebuilt
It was gone. :)
It seems to have been a bug in Xcode. This is what I did to fix it:
Change the font in the label that showed the error, to a dynamic type, as suggested
Select check box for "Automatically Adjusts Font"
Build and run the project (the error disappears)
Uncheck the "Automatically Adjusts Font" box
Change the font back to the previous setting that caused the error
Rebuild the project
The error is still gone.
If the "Automatically adjusts font" box is checked with a non dynamic font this warning will appear. Either uncheck the box on the offending label or use a dynamic font type.
Open your storyboard, right click storyboard in file navigator.
Search for (command F) and delete instances of
adjustsFontForContentSizeCategory="YES"
In the Storyboard, after uncheck every "Automatically Adjusts Font" in the Attributes Inspector, run shift + command + K and then build your project again. This should clean your project and remove the warning.
Swift 5+, Xcode 11+:
Right-Click the storyboard that's having this issue (Check Issue Navigator if you don't know which)
Go to the Open As option and select Source Code
Replace every adjustsFontSizeToFit="NO" with adjustsFontSizeToFit="YES"
Run your application
Watch the warning go away (And even if you undo step 3)
I got this error for automatic adjusting on a button. But I could not find "Automatic Adjust Font" checkbox on right panel. Get rid of warning by going to source code of .storyboard and deleting "adjustsFontForContentSizeCategory" properties on problematic button solved my problem.

Xcode shows two windows side by side

Hello My xcode is showing the screen in half and also not showing storyboard interface builder. below is the screenshot
I have tried to reset the xcode settings as well
defaults delete com.apple.dt.Xcode
But it didn't work. Please tell me how can I fix this
These three buttons up here switch your view. Select the left one.
You're actually stuck in the version editor (which looks at your version repository compared with your current code.)
Because storyboard UI can't be viewed with the interface, it shows the underlying xml.
Also the keyboard shortcut is command + enter (credit to farzadshbfn)
Try click on "Show Standard Editor" button:
Main Storyboard > Right click > Open As > interface Builder - Storyboard
Click First button to show your view controller.

Can't change font in XCode 6.1.1

Within XCode 6.1.1 I'm unable to change the font on my label within my storyboard. I can set 'Text' to either 'Plain' or 'Attributed', but then [T] next to Helevetica Neue 17.0 appears grayed out, and it does not do anything when I click it. This happens in all of my projects.
Screenshot here: https://i.imgur.com/3VOSsVn.png
Thank you!
Edit: Unfortunately none of the answers below have answered my question yet. The [T] is unclickable.. it is grayed out so I can't change the Font to custom under there. And while I could go in and enter code to change the font, I would prefer to do it through the GUI.
This problem was driving me crazy - your workaround works for the normal storyboard, but not for the Watch storyboard which has a custom fonts popup.
I finally found this page:
https://github.com/synergy/synergy/issues/4109
It's a bug with using Synergy - I connected a USB mouse to my Mac and when I click the font "T" icon with the USB mouse, it works!!!!
Actually, you have to first select a syntax category in the detail area. You can press CMD+A to select all categories. Then you can click the "T" and select a new font.
See here: https://developer.apple.com/library/ios/recipes/xcode_help-fonts_and_colors_preferences_help/Recipe.html
In the "font", change "system" to "custom”
You can set font for labels in two ways- programmatically and in storyboard.
In your storyboard, you need to click the little T and then select the wanted font.
In your code, assuming you already set the appropriate IBOutlets, you can use something like
[self.theTextLabel setFont:[UIFont boldSystemFontOfSize:17.0]];
Tap on the "T" sign next to the already assigned font, then change "system" to "custom”. Once the settings are on custom the font can be changed as well as it's weight (ie. light, bold...)
I did find a workaround... I can bring up the font menu by crtl-shift-opt-T and change the font there and changes I make are reflected on the page... but the [T] is still still grayed out for some reason.

uppercase label in xcode storyboard not wanted

I'm using xcode 6 with storyboard for ios app development.
I have a problem with UILabel in view controllers in storyboard: the text is simple and inlower case, but when I run the app in the simulator or in the device I see the Label text in UPPERCASE.
Labels have no outlets, and cannot be modified programmatically.
some one has a solution? I'd prefer not using IBOutlet and setting text by code..
I had somewhat similar problem. In my case everything(title, lables, button texts, etc.) was in upper case. I found out that "Localization Debugging" was on, so when I had language on iphone which was not supported by localization, it turned words automatically to upper case. When I disabled it, everything worked fine again.
Just go to "Product > Scheme > Edit Scheme" and there select "Run" and disable "Localization Debugging". (Sorry, I don't have enough reputation to post images, otherwise I would put here screen)
Hope it helps
I answer myself fot other people.
Nothing to do with this strange thing. It seems a xcode bug. Sometimes the labels appears uppercased, other times are ok.
I discover a trick that was using the attributed text in storyboard. in this way it works correctly.
Another way is to use a outlet and setting the uilabel.text by code.
Bye

xCode crashes when I drag custom object into UIScrollView

I have a custom button that is a subclassed UIButton. When I try to drag it into a UIScrollView in IB Xcode immediately crashes. What gives?
I have this custom button working inside a UIScrollView in at least one other location in my app. Any ideas?
UPDATE:
Uncheck "Use Autolayout" in the File Inspector fixes this problem. See answer below.
I have this custom button working inside a UIScrollView in at least
one other location in my app. Any ideas?
I could crash several Java editor like this. The problem it was in my custom component code:
I have added code, which the designer ( Interface builder) have executed to show my component.
Take extra care at init, viewDidLoad methods in your Button code.
Do not know exactly, But once the same kind of issue happened with me.
My problem was that some of my drawing methods were being called recursively, causing the Xcode to crash. I handled those recursive calls and issue got fixed.
SOLUTION: Uncheck "Use Autolayout" in the File Inspector
Thanks to #BornCoder I decided to try running this on my laptop running Xcode 4.4. When I tried to build I got an error saying this version of Xcode doesn't support Autolayout. I didn't intend to use Autolayout, it looks like Xcode 4.5 does automatically. Unchecking the box fixed it.

Resources