Interface Builder

RSS for tag

Build interfaces for applications without writing code using Interface Builder, an editor within Xcode.

Interface Builder Documentation

Posts under Interface Builder tag

109 Posts
Sort by:
Post not yet marked as solved
3 Replies
5.2k Views
Any hints or experience with the safe area and a hidden tab bar on iPhone X would be appreciated!We've been making updates to our app for iPhone X and we've run into one issue we haven't been able to resolve.Our app uses a UITabBarController. On some screens that are hierarchically below the UITabBarController, we hide the tab bar. On these screens, we normally have a bottom action bar of our own making that has a couple of action buttons in it. We hide the tab bar because it's odd to have this action bar above a tab bar both visually and when touching buttons (because it can be easy to mistap and activate a tab when an action button was the target or vice-versa).The problem occurs when we create one of these views. The view is defined via a UIViewController in an xib. If we create constraints from a subview (say, the bottom of a top level table view or the action bar itself) in the xib to the bottom of the safe area of the view controller's main view, the layout at runtime acts as though the tab bar is still visible even though it is hidden. So we have a space at the bottom of the screen that is the height of the bottom home button plus the tab bar height.After looking for solutions that didn't require specific checks for an iPhone X and iOS 11 (because iOS 10 doesn't have the issue), I relented and started trying anything that could work. If I create two constraints, one with a zero constant to the bottom safe area and one that forces the main view downward by the height of the tab bar, and then only make one of them active depending on what device and OS version is being run, it appears to work. Until it doesn't.The first layout of the screen on iPhone X will work, but if we then (for example) show a modal screen and then return to the first screen, the layout will be incorrect again. The bottom of the main view will go off the bottom of the screen.Uhg.
Posted
by
Post marked as solved
6 Replies
22k Views
HiI recently updated to Xcode 11 GM seed. However I've noticed that the dreaded "Unknown class in Interface Builder file" is crashing my app. I haven't changed any class names or storyboards. Interestingly the app runs perfectly in teh simulator, but crashed on my phone.Here is what is being printed in the output window:MyAppName[9513:4230222] Unknown class _TtC10MyApp24SlideTableViewController in Interface Builder file.Could not cast value of type 'UIViewController' (0x1ebe282b0) to 'MyApp.SlideTableViewController' (0x104d05e08).MyAppName[9513:4230222] Could not cast value of type 'UIViewController' (0x1ebe282b0) to 'MyApp.SlideTableViewController' (0x104d05e08).I've deleted the class and recreated, removed the View Controller from the story board, made sure the view controller is references correctly as is the target, but the problem persists and I'm out of ideas.Is there a "reset" of the storyboard to reference the elements? Or some other way to resolve this?Many thanksCraig
Posted
by
Post not yet marked as solved
7 Replies
2.2k Views
Hi, I'm testing one of my app on iOS 14 with Xcode 12 beta 3 (12A8169g) and I have a problem with my storyboards. Xcode give me this error for all the storyboards that contain a split view controller: An internal error occurred. Editing functionality may be limited. The log generated by the Xcode "Report a bug" button say: Exception name: NSInvalidArgumentException Exception reason: UITabBarController is unsupported as viewController for -[UISplitViewController setViewController:forColumn:] in Primary column It worked correctly on Xcode 12 beta 2. Has anyone encountered the same problem and found a way to fix it? Thank you
Posted
by
Post not yet marked as solved
2 Replies
2.0k Views
Xcode indexing will cause my Mac Mini (M1) to crash when indexing is active (ON). ===> Xcode Version 12.5.1 (12E507) To test the following, I created a smaller OSX desktop application, compared to my main OSX desktop application, which is significantly larger in scope, and size. That said, I enter the following code in the terminal to activate and deactivate Xcode Indexing: 1. Indexing is active (ON) when applied in the terminal : defaults write com.apple.dt.XCode IDEIndexDisable 0 2. Indexing is NOT active (OFF) when applied in the terminal : defaults write com.apple.dt.XCode IDEIndexDisable 1 The application causing the crash with Xcode Indexing turned (ON), creates a PList file for my main application to use, which is an array of dictionary tuples. This application for the moment, creates a baseline array of 4,000+ dictionary objects with eight (8) tuple objects per dictionary. I use the same design with different, and significantly less information to create other PList array of dictionary objects, such as creating a PList array of dictionary objects for one column of objects instead of my application’s eight tableView columns. The smaller PLlist array of dictionary objects for an identified tableView column contains numeric information, which my application analyses to provide statistical data, such as mean, median, mode, maximum, minimum, number of occurrences, histograms, charts, et al. The smaller PList column application does not crash when Xcode Indexing is active (ON). When Xcode Indexing is active (ON) for the larger PList application the following occurs: 1. Xcode quickly usurps all the RAM in my Mac Mini (M1 - 16 GB). 2. Activity Monitor shows “SourceKitService” climbs steadily to (20 GB) from (140 MB). 3. Activity Monitor shows “swift-frontend” climbs steadily to (80 GB) from (1 GB). 4. Activity Monitor shows “Physical Memory: 16 GB” 5. Activity Monitor shows “Memory Used: 14.01 GB” 6. Activity Monitor shows “Cached Files: 1.91 GB” 7. Activity Monitor shows “Swap Used: 29.49 GB” 8. Activity Monitor shows “App Memory: 3.69 GB” 9. Activity Monitor shows “Wired Memory: 1,012.5 MB” 10. Activity Monitor shows “Compressed: 8.53 GB” 11. Activity Monitor shows “Memory Pressure: Max” My Mac Mini (M1) does not hesitate to show the Force Quit Modal: “Your system has run out of application memory.” Xcode ===> (“Xcode set at 309.0 MB”) Finder ===> (“Finder set at 158.2 MB”) Boom, I must restart my computer. When Xcode Indexing is NOT active (OFF) the following occurs: 1. The Mac Mini (M1) does not crash. 2. My application will NOT allow me to connect to any viewController outlet in my application from any IB. 3. Attempting a connection from IB to the associated properly named “viewController” presents the following error message: ===> Could not insert new action connection: could not find any information for the class named “blah blah blah …” <=== This exercise to turn “ON” and turn “OFF” Xcode indexing for my situation is repeatable. Turning (OFF) Xcode indexing introduces the above "Could not" error message, and turning (ON) Xcode indexing prevents the error message from showing with my smaller indexed applications. So, for the moment, I can manually create an outlet in the “viewController” with copy and paste, “change” the new outlet name and function, then “connect” the IB item to the new viewController outlet, using “control-drag.” This “get-by-product” effort allows me to continue making connections without frustration. For me, and my Mac Xcode programming experience, when Xcode Indexing is “OFF,” all the other internet suggestions to fix the “Could not insert new action connection” failed miserably. Those suggestions obviously worked for the individual poster, but unfortunately not for me. When Xcode crashes with this error, my computer asks to send the issue to Apple, so I say “Yes.” This experience blindly took me more than two months to isolate my application issue, through trial and error, trying to follow the numerous suggestions on the internet to no avail. I turned OFF Xcode Indexing a few months ago to prevent the larger indexing application from crashing. My efforts to resolve the “Could not insert new action” message included: 1. Creating new view controllers. 2. Copying the original viewController code into the new viewController. 3. Clean and rebuild. 4. Delete derived folders. 5. Reviewing possible “Automatic and Manual” assistant editor issues. 5. Believing my suspect object copy methods from one IB to another IB, caused the issue, therefore causing me to rebuild an IB or two from scratch. The Xcode Index crashing issue, and the subsequent “Could not insert new action” issue happens to be annoying, but I am able to continue programming my application without Xcode indexing. My main concern and my current dilemma right now happens to be, what will become of my application, since I cannot index the application without Xcode indexing causing my Mac Mini (M1) to crash … ? Just curious … :] All suggestions, as always, are welcome. Best regards, jim_k
Posted
by
Post not yet marked as solved
2 Replies
1.3k Views
I have created a UIButton in storyboard, and have set an image for the UIButton (the image is in assets.xcassets). The button shows up in the simulator and when run on an iPhone. However, if I quit the app on the iPhone and open it again, the button disappears, but I am still able to click it and it works. The same thing happens when I uncheck "debug executable." When I check the view hierarchy, the button is on top of the hierarchy but is invisible. Using infoButton.isHidden = false also does not work. In my button's view controller, I have called view.bringSubviewToFront(_: infoButton) in viewDidLoad(). I have also tried setting the button's image programmatically, but it still doesn't show up. However, when I set a background color for the button with infoButton.backgroundColor = UIColor.blue, I can see a blue box where the button should be, but no image. Here are my settings for the UIButton: I would appreciate any help, thank you.
Posted
by
Post not yet marked as solved
2 Replies
947 Views
Whenever I switch away from a Nib file and then come back to it, Interface Builder "resets" its state. That is, the left-hand outlineView that shows the structure of an IB document collapses to a stupid "minimized" width and the canvas has scrolled away from the view/window I had selected before switching away from IB. This has been a constant issue in Xcode 13 and persists in Xcode 14 Beta 2. Is anyone else seeing this behavior? I have filed multiple Radars about it over the last year and not one has gotten a response (shocking, I know).
Posted
by
Post not yet marked as solved
1 Replies
752 Views
I am very new to Swift and I am trying to use this function so my app doesn't trigger the Apple Pay notification. (requestAutomaticPassPresentationSuppression) I am working on react-native. I am trying to create a native module so I can import this function but I am very new to Swift. At this point, I am a bit stuck. Any help would be great. Thank you
Posted
by
Post not yet marked as solved
13 Replies
3.6k Views
Hello, I have been working with storyboards for my projects without any problems. However, since the XCode Version 14.0 (14A309), the "safe area" on the storyboard preview is wrong for landscape orientation, as you can see in the image below: The "safe area" acts as in portrait (with margins on top and bottom) instead of margins on the left and right side as in the previous version. Also changing the device for preview does not help. It seems to affect only the preview, as the safe area is well in place after building it on both iPhone 13 and iPhone 12 mini. Do you have any idea how to fix this? Or is it a bug that should be fixed by the Apple developer team? Thanks
Posted
by
Post not yet marked as solved
3 Replies
1.6k Views
With Xcode 14, the device selection on the bottom of the storyboard canvas has changed, and the iPhone 12 and 13 mini screens are no longer there, as well as there only being one model of iPad. Is there a way to add more devices to this section? I have simulators installed for these devices, and this is the way I've been checking compatibility so far, but this is not sustainable. I appreciate any help that you can give me.
Posted
by
Post marked as solved
2 Replies
1.4k Views
I have some NSPanels that are not resizable, the App is not localized and and don't need Layout Constraints. Any time I edit an NSText field in the .xib, XCode 14.2 starts to report many errors: "Views without any layout constraints may clip their content or overlap other views." I spent a lot of time trying to make XCode stop reporting these warnings, but I can't. Sometimes quiting XCode or restarting my Mac will make these go away. According to XCode Help: "Auto Layout is enabled by default. To disable Auto Layout, choose View > Inspectors > Show File Inspector and deselect the checkbox for Use Auto Layout." Too bad there isn't any checkbox for Use Auto Layout in the file inspector for the .xib, the .panel's view or the NSText Field so I can't actually do this. The editor>Layout>Automatic menu item is disabled. Is there really any way to disable Auto Layout or has Apple decided to require it?
Posted
by
Post not yet marked as solved
5 Replies
2.5k Views
Since updating to Xcode 14.3 every view controller in every storyboard is not updating its IBDesignable's with an error saying it can't find the right .app with the right architecture. This all worked fine in Xcode 14.2 I'm running on an M1 mac mini Error below: /Users/****/Documents/Projects/****/****/Modules/Onboarding/Base.lproj/Onboarding.storyboard Failed to render and update auto layout status for ****ViewController (3EC-3V-hGn): dlopen(****.app, 0x0001): tried: '/****' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot****.app' (no such file), '****.app' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) I've tried following a stackoverflow post that suggested changing "Build Active Architecture Only" to "No" for debug builds. When I rebuilt I got a prompt from Xcode saying the build failed, and it asked me to turn on Rosetta to try again. I didn't try this as it seemed like this is broken, given it works fine on 14.2
Posted
by
Post not yet marked as solved
1 Replies
491 Views
My app has 2 dylibs linked, in build settings run path is set to "@executable_path/../Frameworks" and a copy file rule is also there. The app runs fine for years now (in App Store). But once I turn on IB_DESIGNABLE for a custom view, IB reports errors like below: It seems IB tries to load the dylibs from somewhere in Xcode.app. What should I do in order to get IB_DESIGNABLE to work in IB?
Posted
by
Post not yet marked as solved
0 Replies
808 Views
Hi, the problem is not dangerous to life, I don't want see the yellow button on top of the editor. 'Autoresizing Mask' is set to about 50 items, that works, except tableView, 10 warnings. The tableView has 10 columns of 20 pixels width, min 10 and max 100000. The ' Add new constraints' options are all grayed, so what ? In an other project a warning was set for arrayController, I don't like Auto Layout, the blue help lines are enough. My question is : How do i can suppress this warnings ? Kindly, Uwe
Posted
by
Post not yet marked as solved
1 Replies
382 Views
I am trying to integrate a UIKit view into my SwiftUI project using UIViewRepresentable as an intermediate. A TestViewVC.swift file was created containing just a simple IBOutlet: import Foundation import UIKit class TestViewVC: UIViewController { @IBOutlet weak var testLabel: UILabel! } A corresponding TestViewVC.xib file was creating containing just a single label centred on screen. The TestViewVC was then assigned as the File Owner's class. These are then displayed within the SwiftUI context through the use of a TestRepresentableView.swift and TestViewVC.swift class (shown below). //TestRepresentableView.swift import SwiftUI struct TestRepresentableView: UIViewRepresentable { func makeUIView(context: Context) -> UIView { // Load the XIB file and return its view let nib = UINib(nibName: "TestViewVC", bundle: nil) return nib.instantiate(withOwner: nil, options: nil)[0] as! UIView } func updateUIView(_ uiView: UIView, context: Context) { // Update the view here if needed } } //TestViewVC.swift import SwiftUI @main struct TestApp: App { var body: some Scene { WindowGroup { TestRepresentableView() } } } The app runs fine on debug however an NSUnknownKeyException is raised whenever label is connected to the IBOutlet. (Or any other outlet for that matter, even simply connecting the view results in the same error). Any idea of which this is happening?
Posted
by
Post not yet marked as solved
2 Replies
838 Views
When I upgraded Xcode to the latest version 14.3, I have some problems with AEPServices. Showing Recent Errors Only underlying Objective-C module 'AEPServices' not found failed to verify module interface of 'AEPServices' due to the errors above; the textual interface may be broken by project issues or a compiler bug So I use more solutions about config search paths, target in build settings, and build phases, but it does not work for me. If anyone has encountered this problem, please give me a solution to fix it. Thanks a lot!
Posted
by
Post not yet marked as solved
0 Replies
428 Views
Is it possible to display the screen same as the size of iphone on Ipad even if the app supports iPad. Want to prevent resize of screens on iPad for a library even though the app supports iPad. is that possible?
Posted
by