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

105 Posts
Sort by:
Post not yet marked as solved
0 Replies
287 Views
The Storyboard Interface Builder has a Switch object that toggles between On, and Off, states. While in the On state it looks normal. While in the Off state it is grayed out. I have a use for this object for the user to toggle between two options which are other than On, and Off. For my intended use its Off state gray out is undesirable. Is there way to prevent this switch graying out in its Off state?
Posted
by
Post not yet marked as solved
1 Replies
1.2k Views
I am generating the IPA file using command line tools for custom IPA generation. Each time, it asks for login credentials during code signing. However, this doesn't work for me because I always use a different developer's profile to generate the IPA. Consequently, I am unable to enter the login passcode for each developer's profile. Please let me know if there are any other steps to avoid code signing while generating the IPA file. The scripts as follows: xcodebuild -workspace -scheme -archivePath archive xcodebuild -exportArchive -archivePath -exportPath -exportOptionsPlist.
Posted
by
Post marked as solved
1 Replies
534 Views
I used the Interface Builder to place a Switch object in a view. I ctrl dragged it into the Assistant to make its handler a method of the class the view's is in, which is itself a subclass of "UITableViewController". A dialog box appear into which I entered the function name, and select the the option to have the sender as an argument. The result is function of the form: @IBAction func switchStateChange(_ sender: UISwitch) { } Now I need to query this Switch's On/Off state from elsewhere in the program, and if necessary change its state. It is not a good solution to save the sender parameter to a global variable because then it would require the user to change this switch's state before that global variable is set. What is needed is to identify, and lookup, this switch object to access it from anywhere in the application. How is this done?
Posted
by
Post marked as solved
2 Replies
1.1k Views
The need is to persist between launches the state of storyboard objects such as of type UISwitch, UITextField, etc. Can this be done using @AppStorage? If so how can @AppStorage be set to watch these? I tried getting @AppStorage to watch an outlet class member variable that is connected to the storyboard object: @IBOutlet weak var iPhoneName: UITextField! @AppStorage("iPhoneName") var iPhoneName: String = "" This got an error because the variable to be watched is already declared. I decided to make the the watched variable different than the one connected to the Storyboard's UITextField object: @AppStorage("iPhoneName") var striPhoneName: String = "" and got the error: Unknown attribute 'AppStorage' . In what import library is @AppStorage defined? If @AppStorage cannot be used for this, what is the easiest way to code storyboard object persistence? I am looking for an easy, and quick way. I am not concerned with memory usage right now.
Posted
by
Post not yet marked as solved
0 Replies
426 Views
I was able to duplicate (option + Drag) a ViewController on my canvas the first time, although wasn't easy. The second time, I had so much trouble to get it to work, then finally (option + drag) worked again. I am trying to duplicate the 3rd time and it still is not working. I am able to copy paste the ViewController, the only issue is that I have no visual representation on the canvas, while I do have the duplicate in the document outline and I can do what ever I want to it there, however I prefer seeing a visual rep. on the canvas as well. Is this a bug in Xcode 15 that I am not able to easily (option + drag) a ViewController to duplicate it, like it is done for the UI Objects. On that note it (option + dark) is also a hassle to get it to work the first time even up to the 4 time around on the ViewController itself. Any ideas or info is appreciated.
Posted
by
Post marked as solved
1 Replies
658 Views
I do not know what I did to make it so, but somehow I accidentally got Xcode Interface Builder to display a storyboard file in an undesired mode which displays the UI buttons, and text fields, in rectangles as shown in the screenshot below. How do I reverse what I did to get it out of this mode?
Posted
by
Post not yet marked as solved
0 Replies
430 Views
The goal is to have the background, and foreground, colors show the current state of a UIButton on a storyboard file. The attempt to do that is done with this code: var toggleLight: Bool = false @IBAction func toggleLight(_ sender: UIButton) { if( toggleLight ){ toggleLight = false sender.baseBackgroundColor = UIColor.black sender.baseForegroundColor = UIColor.white }else{ toggleLight = true sender.baseBackgroundColor = UIColor.white sender.baseForegroundColor = UIColor.black } tableView.reloadData() } I get these errors: Value of type 'UIButton' has no member 'baseBackgroundColor' Value of type 'UIButton' has no member 'baseForegroundColor' I do not understand this because in file "UIKit.UIButton" I see: extension UIButton { ... public var baseForegroundColor: UIColor? public var baseBackgroundColor: UIColor? ... } What has gone wrong there?
Posted
by
Post marked as solved
1 Replies
688 Views
I am not able drag a reference object from a Storyboard screen to code in the Assistant. The expected blue line appears as the screenshot shows, but no code is created in the Assistant. This reference object is not in the Launch Screen. When the the screen this object is in is highlighted, the correct file opens in the Assistant. Dragging this object from the "Content View" folder also does not work, even though the blue line also appears. I was recently able to do this. Something changed. What might have changed?
Posted
by
Post not yet marked as solved
5 Replies
1.3k Views
I am getting the following errors when I attempt to build my project since I updated Xcode to Version 15.0 beta 2 (15A5161b). I am wondering if anyone could help me figure it out as I have already cleared the cache and the build folder as well as reinstalling the firebase package entirely. Here are the two errors I have been receiving: "failed to verify module interface of 'Project_Name' due to the errors above; the textual interface may be broken by project issues or a compiler bug" (The code on the line this error is on is on a autogenerated file titled "Project_Title.private" and cannot be edited, "// swift-interface-format-version: 1.0") The other error I assume also has to do with the above issue, "no such module as 'firebase'" ( the code on line of question is "import Firebase".) I would appreciate ay help I could get because I cannot find any documentation or similar problems. I have attached screenshots below for your convenience. Thank you for your help!
Posted
by
Post not yet marked as solved
0 Replies
469 Views
Hi all, I have been racking my brain about this for hours now and cannot seem to get it figured out. I have created a custom header using a Swift UI View. When I put the HeaderView onto say my Menu View it is fine until I start adding content. I want to add navigation links in my Menu View to navigate my app. At that time, the shape part of my header start to get bumped up out of position but the text stays where it should. How do I prevent the header from moving at all? I want it to be in a fixed position on each screen. I will be using the same header just with different text on each screen. Here is my HeaderView struct HeaderView: View { let title: LocalizedStringKey var bgColor: Color var body: some View { GeometryReader { geometry in ZStack { Ellipse() .fill(self.bgColor) .frame(width: geometry.size.width * 1.4, height: geometry.size.height * 0.30) .position(x: geometry.size.width / 2.00, y: geometry.size.height * 0.035) .edgesIgnoringSafeArea(.all) VStack{ Text(self.title) .font(.title) .fontWeight(.bold) .foregroundColor(Color.green) .padding(.top,20) Spacer() } } } } } Here is my Menu View: struct MenuView: View { @StateObject var viewModel = MenuViewViewModel() init() {} var body: some View { NavigationView{ VStack{ HeaderView(title: "Menu", bgColor: Color.green.opacity(0.3)) HStack{ Image(systemName: "bell.fill") NavigationLink("Notifications", destination: NotificationsView()) } HStack{ Image(systemName:"person.crop.circle.fill") NavigationLink("Profile", destination: ProfileView()) } HStack{ Image(systemName: "puzzlepiece.fill") NavigationLink("Projects", destination: ProjectsView()) } } } } } I can provide screenshots of what happens after I do this if need be. Thanks in advance.
Posted
by
Post not yet marked as solved
4 Replies
1.1k Views
Hello I'm encountering a strange error, probably linked to a bug in Xcode 15 beta 2. When running my app from xcod 15 Beta 2 (either on device running iOS16.5.1 or any simulator running iOS17) for some views I receive the following fatal error: 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named StopwatchSupport.ActivityIndicatorVisualStyle because no class named StopwatchSupport.ActivityIndicatorVisualStyle was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' From the stack trace, the error seems to be appearing just afterthos calls: #3 0x00000001b3faef54 in UINibDecoderDecodeObjectForValue () #4 0x00000001b3faf1ec in UINibDecoderDecodeObjectForValue () Thanks for any help guidance provided.
Posted
by
Post marked as solved
2 Replies
1.1k Views
I added a scene to an existing story board that already has other scenes. I put focus on the new scene, and in the Identity Inspector's "Class" field I gave it a class name. The "Storyboard ID" field did not show in this inspector. Why would it not? No file named after the class name I gave it appeared in the "Project navigator". Is this supposed to happen automatically? Or must I create this Swift file that contains the class definition for the scene manually?
Posted
by
Post marked as solved
1 Replies
561 Views
I have a UITextField object on a storyboard's scene. Its "Editing Did End" event is connected to the view controller's "actIPhoneName()" event handler method as shown in this screenshot. I configured the keyboard to show its "Done" key. I expected that when this Done button is touched, that the keyboard would disappear, and the actIPhoneName() method would be called. But neither of these happen, nor does anything else. The UITextField object remains in edit mode. The breakpoint is never reached. What must I do to make the Done keyboard key work to make the UITextField object lose its First Responder status, and call its "Editing Did End" event handler method?
Posted
by
Post marked as solved
2 Replies
1.4k Views
I have a UITextField object in a storyboard's scene where the user is make numeric entries. Because this field is for numbers only I set the keyboard type to "Number Pad" in attributes. But this keyboard does not have a return key which leaves the user unable to signal when the entry is complete, the keyboard should be put away, and the entered value processed. I tried all the other numeric keyboards also, and found that none of them has a return key. The default keyboard does, but it is a full alphanumeric keyboard which is undesirable for that field. How can I cause the return key, done key, or whichever does that function, appear on a numeric only keyboard?
Posted
by
Post marked as solved
1 Replies
582 Views
Hello, I am a first-time app developer and I have not posted on forums before, so please bear with me if my question is basic or amateur. I have created an app on Xcode with storyboard. I have not added any code yet except for the AppDelegate, Scene Delegate, and View Controller files which are automatically added when the project is created. When I try to build, I get the following error: Description: Internal error. Please file a bug at feedbackassistant.apple.com and attach "/var/folders/w5/32zs74y9287ddqdp_yjkkdbw0000gn/T/IB-agent-diagnostics_2023-07-09_09-58-08_842000" I have filed a bug, but was wondering if any of you know of a workaround. Looking into Log.txt, I see the following error: Failed to compile nib consisting of IBCLLocationButton (x1), IBMKMapView (x1), IBProxyObject (x4), IBUIButton (x3), IBUIContainerView (x2), IBUIView (x2), IBUIViewAutolayoutGuide (x1), and IBWKWebView (x1). Exception name: NSInvalidArgumentException Exception reason: UIImage instances should generally not be encoded in NIBs - attempting to encode '<UIImage:0x6000002b1830 anonymous {41, 41} renderingMode=automatic(original)>' for key 'UIImage' of <UIImageView: 0x7f7e45f32a60; frame = (0 0; 41 41); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x60000311c8c0>> My Main.storyboard file consists of a scrollview, with a table view inside. The table view has a custom prototype cell. My Xcode version is 14.2, and my deployment target is ios 16.2. I am using MacOS Monterrey. I have seen similar errors being discussed on this forum and others, but none exactly pertaining to the specific platform I am using. I have already tried cleaning the build folder and resetting my image views. Any help would be appreciated. Thank you.
Posted
by
Post not yet marked as solved
0 Replies
399 Views
When porting an old Mac project to Silicon (universal) I got an issue with IB to open MainMenu.xib: Trust opening older file format? “MainMenu.xib” uses an older format that is potentially insecure when decoded. If you trust the content of this file, open and save it to upgrade to the modern format. The "open and Upgrade" button make the MainMenu.xib not editable: it seem that every submenus has disappeared. How can I fix it ? Any suggestion will be greatly appreciate.
Posted
by
Post not yet marked as solved
2 Replies
644 Views
This is a very annoying error which is causing a crash in my app. The error description is very vague and I'm guessing mostly related to oddities of Xcode 15 Beta. Here is the full error stack: *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named _UIRecessedMaterialView because no class named _UIRecessedMaterialView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' *** First throw call stack: ( 0 CoreFoundation 0x00007ff80048c88a __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff800057894 objc_exception_throw + 48 2 CoreFoundation 0x00007ff80048c768 -[NSException initWithCoder:] + 0 3 UIFoundation 0x00007ff804a1eb4d UINibDecoderDecodeObjectForValue + 352 4 UIFoundation 0x00007ff804a1eebe UINibDecoderDecodeObjectForValue + 1233 5 UIFoundation 0x00007ff804a1e9e2 -[UINibDecoder decodeObjectForKey:] + 257 6 UIKitCore 0x000000010e566a9f -[UIView initWithCoder:] + 1327 7 UIKitCore 0x000000010e4ed417 -[UIScrollView initWithCoder:] + 65 8 UIKitCore 0x000000010e34cbd5 -[UITextView initWithCoder:] + 65 9 UIFoundation 0x00007ff804a1ecb4 UINibDecoderDecodeObjectForValue + 711 10 UIFoundation 0x00007ff804a1e9e2 -[UINibDecoder decodeObjectForKey:] + 257 11 UIKitCore 0x000000010d97e7f0 -[UIRuntimeConnection initWithCoder:] + 160 12 UIFoundation 0x00007ff804a1ecb4 UINibDecoderDecodeObjectForValue + 711 13 UIFoundation 0x00007ff804a1eebe UINibDecoderDecodeObjectForValue + 1233 14 UIFoundation 0x00007ff804a1e9e2 -[UINibDecoder decodeObjectForKey:] + 257 15 UIKitCore 0x000000010d977a79 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 447 16 UIKitCore 0x000000010d97a77e -[UINib instantiateWithOwner:options:] + 1118 17 UIKitCore 0x000000010d532dab -[UIViewController loadView] + 643 18 UIKitCore 0x000000010d533128 -[UIViewController loadViewIfRequired] + 129 19 UIKitCore 0x000000010d533960 -[UIViewController view] + 27 .... Has anyone found the solution to this issue? This is preventing us from fully validating our iPadOS 17 upgrade builds. Thanks in advance.
Posted
by
Post marked as solved
25 Replies
7.6k Views
We use Storyboards and custom fonts in our app. Once we started developing new features for iOS 17 and did the first build in Xcode 15, we've noticed that in quite a few places incorrect fonts are set to views. In some places it is incorrect weight, while in other it's completely different font. Some observations: Fonts may change the next time app is build. E.g., instead of SF Pro Display Semibold we got SF Pro Display Heavy, and then after few relaunches it switched to Nunito Bold 😵‍💫 We’ve ensured that correct font is set in Storyboard, and even tried to re-assign it. That didn’t help. All custom fonts are properly added to a target and are registered in info.plist All custom fonts are listed in UIFont.familyNames, so they are indeed registered with the system. Wrong fonts are loaded on both development environment and in TestFlight builds We’ve never experienced anything similar before Xcode 15 What we've tried: Re-assigning fonts in Storyboard. Creating new Storyboard in Xcode 15 and copying screens into it. I wonder if anybody else having similar issues and maybe knows the workaround. Thank you. P.S. I've filed a Feedback to Apple: FB12903371
Posted
by
Post not yet marked as solved
1 Replies
457 Views
Hi all, My interface displays a text field bound to an NSNumber that I use internally as unsigned int. That NSNumber is actually saved with Core Data as Integer 16. However, the interface displays the number signed, meaning anything above 32.768 is actually shown to be negative. I couldn't find a way to force my NSNumberFormatter to display unsigned numbers. Setting the minimum value to 0 also doesn't work, since internally it's gonna be positive anyway. Could you help me display my 16-bit integer as an unsigned int between 0 and 65.535? I am building a macOS app using Objective-C, macOS SDK 10.14 and Xcode 14.3.1.
Posted
by