Questions tagged [interface-builder]
Interface Builder is a visual design tool used to create user interfaces for Apple's macOS and iOS platforms.
6,238
questions
0
votes
0
answers
4
views
How to communicate between a SafariExtensionHandler and SafariExtensionViewController.xib
I'm writing a safari app extension using the default Xcode project and objective c. I want to add interface items to the popover(as Xcode has defined it with the SafariExtensionViewController.xib) and ...
-1
votes
1
answer
31
views
ContentHuggingPriority and CompressionResistance not honored by StackView with custom control as subview
I've created a horizontal UIStackView with two subviews:
A UILabel.
A custom UIControl.
I would like the Label to expand within the view and for the Control to hug its content.
Content Hugging ...
-1
votes
1
answer
26
views
Xcode constraints not changing equally
I'm trying to format a home page of my app and want the distance in the middle of two buttons to stay the same while keeping them centred on the screen using alignment in Xcode. I've been playing ...
0
votes
1
answer
24
views
iOS: Navigation Style: Navigator, Browser, Editor
On a UINavigationBarItem in Interface Builder, there is a dropdown for the style showing: Navigator, Editor, Browser. Anyone know what this selections means and what the options do?
0
votes
1
answer
37
views
Finding Missing Constraint
When I build my app Xcode gives me five warnings relating to missing constraints. But clicking on them in the Navigation Panel only takes me to a ViewController in the Storyboard and doesn't ...
0
votes
1
answer
31
views
How to get UILabel to center text vertically?
I am assigning some text into a UILabel to display a single character, a symbol, with a Unicode value. Nothing unusual. But it is not being centered vertically when displayed. I've fiddled with ...
0
votes
1
answer
57
views
Need constraints for Y position or height, but height is determined by labels
I have a custom view with nested stack views and labels, I believe I have enough constraints to not cause an error, however, I suspect the interface builder might be losing the label defining the ...
0
votes
1
answer
48
views
menuItem Action not executed in a swift app
I have a swift app for MacOS, and have a menu with sub menuitems. I add the menu from the appdelegate and assign an action via the interface builder, but the target action is never called:
statusItem =...
0
votes
0
answers
46
views
How to set textView 100% height of parent
I need to make the tv stretch to 100% of the height of the parent view. If I add an upper and lower constraint - the parent view narrows to the size of the textview
I tried to align the vertical ...
0
votes
2
answers
571
views
Swift: Why does "Pop Up Button" throw NSInternalInconsistencyException?
I created a "Pop Up Button" following the WWDC video here:
"Build interfaces with style"
https://developer.apple.com/videos/play/wwdc2021/10196/?time=602
After adding the pop up ...
0
votes
1
answer
76
views
@IBAction fails to work in Swift, though I can connect it in Interface Builder, and it works in Objective-C
In all cases, I can wire user-interface buttons to actions with Interface Builder. But the buttons work for Objective-C but not for Swift.
Objective-C example (it works):
- (IBAction)TogglePlaying:(id)...
0
votes
0
answers
78
views
How do I connect UITextView to @IBAction using Interface Builder in Xcode?
Why am I not able to connect a UITextField in a view controller scene on Storyboard to a @IBAction? When I Ctrl drag and drop to the view controller class in the swift file, there isn't even an option ...
2
votes
0
answers
163
views
How to change status bar color in launch screen. Swift
Status bar color in my launch screen doesn't change. On other viewController status bar color changes. View controller-based status bar appearance installed on the NO. How can I fix it?
-1
votes
1
answer
21
views
Where is dragThatCannotResizeWindow in Interface Builder/Storyboard?
I found the NSLayoutConstraint.Priority.dragThatCannotResizeWindow to be very useful. Though I usually write constraints with code, it sometimes gets too long and I want to move them to IB.
How I can ...
0
votes
1
answer
87
views
Dynamic height for UITableView header view - Problem with huge margins
In my application I have a UITableViewController that allows preview of a photo and description to that photo, which are both contained in the UITableView's header. The description label needs to be ...
2
votes
2
answers
141
views
Does iOS support nested custom subviews created with independent .xib files?
It doesn't seem possible to create nested custom subviews using .xib's created with Interface Builder. For example I want to create a custom BarView and nested inside of that a custom FooView where ...
1
vote
0
answers
144
views
Xcode 13.4.1 User defined runtime attribute string "0" saved as ""
this only started after upgrading to Xcode 13.4.1
I have a User defined runtime attribute named numberString that has values 0-9 defined as string. The custom view then sets them to a label text ...
0
votes
1
answer
53
views
How to access an Interface Builder UILabel with code?
There's a UILabel in Interface Builder without a custom class or tag. I need to programmatically change the y coordinate of this UILabel. I know I can reference the UILabel by setting the tag and ...
-1
votes
1
answer
31
views
How can I represent objects as an interface
How can I represent the following javascript object as an interface:
I did try using http://json2ts.com/, however did not give a clean and dynamic interface.
Hence, I do not want the id/codes (i.e. ...
0
votes
2
answers
148
views
Is IOS Scroll View is Scrollable in Storyboard while Designing? Not Runtime in Simulator
In Storyboard i have view controller, inside i have a scroll view. question is scrollview is not scrollable while design time (UIKit). is it like that ? though, it works fine in simulator.
1
vote
2
answers
176
views
Is there a iOS standard for adding error messages to textFields?
I am trying to perform text validation on my textFields for user login and sign up and I want to display error text depending on what the user inputs. I have been trying to find if there is any sort ...
0
votes
0
answers
115
views
How do I add my own properties to the Bindings Inspector in Xcode?
When editing a .xib in Xcode, I can select a view or other object, navigate to the "Bindings" tab in the Inspector, and bind its properties to properties of other objects. This is all well ...
1
vote
1
answer
229
views
SplitViewController: How do I replace a the secondary view rather than pushing a new one?
I have a simple storyboard as shown below. Clockwise from the split view controller we have the navigation controller, a "theme chooser" and a little game. All of the buttons in the theme ...
1
vote
2
answers
34
views
Unwanted space below vertical stack using interface builder
There is an unwanted space below my last container ("Container View 5") that I can't seem to get rid of. All 5 of my container views are within a vertical stack view. The bottom space of the ...
0
votes
1
answer
29
views
Center View vertically in relation to the Views next to it
Given the layout below:
I wanted to know if it's possible to center vertically the ImageView on the left in relation to the views on the right so that, if any of the labels grow, the ImageView would ...
0
votes
1
answer
54
views
Implementing context menu for NSTableCellView
I have a table view where I would like to have a different context menu appear when right-clicking on a cell vs. when right-clicking on an area where there are no cells. I'm trying to do this using ...
0
votes
1
answer
53
views
Tab Bar Icon Doesn't show when selected
I have a tab bar controller and I have set both images using assets for selected and unselected icons. The icons show up correctly in interface builder
when I spin it up on the simulator and that tab ...
0
votes
0
answers
35
views
swift interface builder: can only create an action, not an outlet (cannot change the collection)
I'm making an interface builder demo in swift and I wanted to create an outlet for my text field. However when I control-drag it to my view controller as always, it doesn't let me change the ...
0
votes
0
answers
74
views
Multicolor SF Symbol in macOS 11 Big Sur
I want to programmatically add to the toolbar the "star.fill" symbol in multicolor yellow mode.
I can do it via Xcode/IB properties.
But I don't understand how to do it programmatically, ...
0
votes
1
answer
62
views
NSRangeException Causing Interface Builder To Act Weird
I have a problem with my 'Main.storyboard' file. I am using Xcode 13.3.1. Here is an image of the Interface Builder:
As you can see, one of the view controllers is only showing the bounds of its ...
1
vote
1
answer
202
views
Interface Builder not working with xib, storyboard, assets
Xib, storyboard, asset files are not shown by Interface Builder in my Xcode. They all are opened as text files.
When I right click and choose Open As..., there is only a grayed out None option.
When I ...
1
vote
2
answers
839
views
How to scale margin based on screen sizes with auto layout?
Imagine I have a UIImageView with a certain aspect ratio constraint (this handles the height/bottom constraint), pinned to superview's top, leading, trailing with 5pt in a 100pt width screen in XIB/...
1
vote
0
answers
13
views
How does a XIB file in a ViewController is called
I know how to create a XIB for UIView or UIViewController classes. What I want to know is the lifecycle of XIB?
How it is constructed. I think it comes before ViewDidLoad but I don't have any ...
0
votes
2
answers
2k
views
Navigation to/from Tab Bar Controller
EDIT - Simplified version:
If I go from a ViewController to a Tab Bar Controller via a Button, how do I get back to the ViewController? How do I (can I?) add a button to the Tab Bar to do so?
(the ...
0
votes
1
answer
567
views
Interface Builder not honoring Safe Area alignment constraints
In Interface Builder, setting the constraints for a UI element (let's say a button) doesn't change if I make the aligment proportional to the Safe Area or proportional to the Superview.
I have a ...
0
votes
1
answer
149
views
Drag and Drop( ctrl+drag) Problems in Xcode
There are two places within Xcode (version 13.3) where I can't drag and drop anymore.
Trying to move a file to a Group. I have tried just clicking and dragging, control-click, option-click, command-...
0
votes
1
answer
754
views
How can I apply a font to a button when the button style is "Filled"?
The target I want to achieve is a radiobutton with
a filled frame,
a padding between text and image
and a specific font for the text.
My problem is that I cannot get all 3 conditions successfully ...
0
votes
0
answers
30
views
Adding IB constraints breaks UIPickerview - ObjC
I have a view built with interface builder. Whenever I add a pickerview (either via IB or programmatically) on top of the existing IB view, the pickerview will not work. The elements within the ...
0
votes
0
answers
185
views
How to use color sets in designable views in storyboards?
The situation and steps to reliably reproduce:
Set up a macOS app project with Swift and storyboards for UI in Xcode.
Define an arbitrary color for the "AccentColor" color set in the asset ...
1
vote
0
answers
393
views
How to use a variable in a Label text in the interface builder with the storyboard (Swift 5)?
Please I need help, I searched everywhere on Internet but didn't found no answer.
How to use a variable in a Label text in the interface builder with the storyboard (Swift 5, Xcode 13) ?
To be more ...
0
votes
0
answers
250
views
How do you make an NSWindow visible and in focus that was declared in Interface Builder?
I have an NSWindow designed in Interface Builder, and I want this window to be appear programmatically and be given focus. In my case the window appears, allows itself to be configured with titles, ...
-1
votes
1
answer
46
views
Xcode / InterfaceBuilder: Why aren't IBOutlets and IBActions declared in the baseclass not available in the subclass?
Say I have a class like this:
class MyViewModeledController<ViewModel: FeatureViewModeling>: UIViewController {
@IBOutlet weak var headingLabel: UILabel?
@IBOutlet weak var ...
0
votes
3
answers
338
views
Set view as percentage of width in portrait and percentage of height in landscape, in interface builder using autolayout
I am creating a launch screen that has a centered image. I want the image to be 0.7 of the width in portrait orientation and 0.7 of the height in landscape orientation, so the image is the same size ...
0
votes
1
answer
129
views
Xib dimensions in IB affects final view
I have a problem similar to this one:
Proportional height value is taken from the xib file not from the device
But mine is a TableView cell, so I don't have access to viewDidLayoutSubviews() which is ...
1
vote
1
answer
97
views
How to get rid of spacing between cells of a UITableView on tvOS?
I am trying to build a tvOS app that has a list of channels on the left side of the screen.
I'm using a UITableView for that. It is anchored at the top, left and bottom of the screen and has a fixed ...
0
votes
1
answer
219
views
NSButton wrap title dynamically
What I want to accomplish:
I need a checkbox with a title text that dynamically wraps and breaks on multiple lines depending on a dynamic width established by the parent view. I need a solution that I ...
0
votes
1
answer
727
views
How do I set up right alignment for horizontal uistackviews embedded within a vertical stackview?
I have a vertical stack view comprised of labels and horizontal button stackviews that looks like this:
Label 1 Text Here
SB SB SB SB SB LargeB
Label 2 Text Here
SB SB SB LargeB
Label 3 Text ...
-1
votes
1
answer
186
views
Scaling a label placed over an image with Auto Layout (IB)?
In Xcode, I'm trying to place a label over an image using auto layout with Interface Builder. The point is to have the image scale to the different devices, while also scaling the label, so that it ...
-1
votes
1
answer
73
views
Animate Gradient View Upon Cell Selection
I am looking to implement an animation to the gradient view.
Any steps to help with that? Currently I have everything ready and a static background attached to the cells which shows up on selection ...
0
votes
1
answer
110
views
Why can't I set the color of the Bar Tint property in Xcode 13.1
I have a simple storyboard project in Xcode 13.1 consisting of a table view controller embedded in a navigation controller and I want to set the color of the navigation bar to system blue. So I select ...