Xcode IB Stupid Warning

Again, Xcode IB disappoints developers with unnecessary warnings: I cannot remove this warning from my Xcode project.

enter image description here

By double-clicking on the warning, it displays my MainMenu.xib file, but does not give any links to what causes the problem. Any ideas?

EDIT:

I removed most of my .xib for public viewing, but still have an error with very few objects. You can find the file here: https://www.dropbox.com/s/r2piuojr86dhlt9/MainMenu.xib?dl=0

+8
xcode cocoa macos
source share
2 answers

This warning has been shown since Xcode 7, when user interface elements, such as a label column heading or table, use the font style or variation available on an older OS (and of course your project still targets them).

In my project, the heading of the table view column used a system font with a change to the font style "medium" instead of the usual one in a project focused on OS X 10.9 +.

It is strange that I had to restart Xcode, as Interface Builder refused to change the style of the control. Perhaps a small glitch in this earlier version of Xcode 7.0.1.

In any case, setting each management style to Regular or changing the project’s target goal to 10.11 should fix the warning.

+2
source share

Once again, Xcode IB disappoints developers with unnecessary warnings.

I felt the same thing about it, until I saw how my printing house was different at 10.10 compared to 10.11. It's one thing - a message is garbage without pointing to a problematic storyboard element, see the section on PS messages for semi-processing.

The current answer almost gets it, but the problem is not that font styles are not available for old purposes, but with Xcode that doesn't handle them properly, see the full blog post for more details.

If you want to keep your styles, use a custom text field with a custom property to check. Open the IDC inspector and set your own class in TextField, the preferred font weight attribute will appear in the attribute inspector, set the required value, build and get the result.

 import AppKit @IBDesignable public class TextField: NSTextField { @IBInspectable public var preferredFontWeight: Int = 0 override public func awakeFromNib() { if #available(OSX 10.11, *) { return } guard let weight: Int = self.preferredFontWeight where weight > 0, let font: NSFont = self.font, let name: String = font.familyName, let manager: NSFontManager = NSFontManager.sharedFontManager() else { return } // Full details here – https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/#//apple_ref/occ/instm/NSFontManager/convertWeight:ofFont: // // 1 – ultralight // 2 – thin // 3 – light, extralight // 4 – book // 5 – regular, display // 6 – medium // 7 – demi, demibold // 8 – semi, semibold // 9 – bold // 10 – extra, extrabold // 11 – heavy // 12 – black // 13 – ultrablack // 14 – extrablack if let font: NSFont = manager.fontWithFamily(name, traits: manager.traitsOfFont(font), weight: weight, size: font.pointSize) { self.font = font } } } 

If you don’t like the styles, use a regular font for all the text, it should solve the problem, see my previous answer for the available options.

0
source share

All Articles