Xcode show .xib and .storyboard only as XML - xcode

I don't know the reason, but Xcode from today won't open .xib and .storyboard files as visual editor, but only as XML.
If I right click on one of these file, trying to choose "Open as..." this is the result. Very strange.

Load the corresponding view controller source in the assistant editor, the main editor switched to the IB view. From then on, all storyboards and Xib loaded as IB views.
Select storyboard > Editor > Assistant
All storyboards loaded as IB views.
Not sure it's feature or bug in Xcode.

Related

Connecting a Label/Button from StoryBoard to ContentView in Xcode 13

Options Window
How can I connect a label, button, or other element from my Storyboard to my coding file in Xcode 13? When I first loaded Xcode, there was no storyboard file added to my project. I had to add one myself. Then, when I created labels and buttons on the Storyboard, it wouldn't allow me to connect to the coding file the way I used to (clicking Ctrl and dragging the label/button to the code). I feel like I'm missing something simple but I can't find any solutions online. Thanks in advance.
You have selected a Multiplatform template. This is only supported by SwiftUI.
Select a single platform template (iOS, macOS etc)

XCode : How to get resize view buttons in interface builder

I opened an old project in Xcode 6 Version 6.0 (6A279r).
For certain .xib files IB is showing resize-view buttons as follows:
But, for certain .xib files IB is not showing resize-view buttons:
How can I enable the missing resize view buttons?
Alright, this was simple.
Just go to "Attributes Inspector" and select "Freeform" under size:

Copy and pasting my xib file and keeping References

So I've finished my Universal App for the Apple Store. All the code works I make all the views and references using my iPhone xib file. However, my iPad xib file is blank. So normally I would just copy and paste all the views from my iPhone xib file to the iPad file and resize each view along with its subviews, however, doing this does not copy any references. So I have to manually link each button all over again. Not a big deal, but the app I just made has like 200 buttons and I don't really want to have to link everything again. I was hoping someone here knows how to keep all the references?
I don't know how to copy and paste the view from one xib file to another while keeping all the IBOutlet and IBAction connections. But one thing you could do is go to File->Duplicate in the Xcode toolbar, and duplicate your xib file. That will create a new xib file with the same views and all of the connections intact.

Why can I only view Storyboard's source and not Interface Builder?

I was using Xcode and making changes to my storyboard... no problem. Now, I get the source code for the storyboard but not the storyboard images!
When I right click on the storyboard file, I don't see "Interface Builder - IOS Storyboard" as an option.
Anyone have this happen to them?
see: XCode 4.2 Version Inspector Hides Storyboard
When I right click on the storyboard file, I don't see "Interface
Builder - IOS Storyboard" as an option.
Open As > InterfaceBuilder - IOS Storyboard
probably you opened the file as source code...
What's always worked for me when Open As -> Interface Builder - iOS Storyboard isn't an option is to:
Close Xcode
Reopen
Sometimes this happens when you have:
Just resolved a merge conflict
Split into diff view to compare previous and current commits
Click this icon in the top right of the Xcode window

Adding outlets to iPhone View

I am creating a custom iPhone View in MonoTouch through the interface builder in XCode (In monodevelop New File -> MonoTouch -> iPhone View).
When selecting a new iPhone View it creates an xib file, but no .h file is created, so how can I create outlets?
I usually drag an outlet from my label/button etc. to the .h file, but since it doesn't exist for this view, I don't know how to create the outlets.
Can someone point me in the right direction, since all articles on google are for the old versions, where outlets where created differently.
When you double-click a .xib in MonoDevelop, MonoDevelop will generate header files for your [Register]'d C# classes that subclass ObjC types and export them to a temporary Xcode project, where you can use Xcode to drag&drop Outlets and Actions.
Adding a new iPhone View file (.xib) does not auto-create any backing C# classes for you, it just creates the .xib, therefore MonoDevelop does not autogenerate any header files for you when you double-click the .xib.
When Xcode launches, you can manually create some Objective-C headers for this .xib and drag&drop outlets or actions to it (or you can create C# classes in MonoDevelop before double-clicking the .xib). When you switch back to MonoDevelop, MonoDevelop will "import" the header files, translating them into the equivalent C#.
While in Xcode, you can also add .xib's there and MonoDevelop will import those as well.
The Xamarin documentation has a good tutorial on this. There is a section for Adding Outlets and Actions to the UI using Interface Builder in Xcode4
Adding an Outlet In order to create the Outlet, use the following
procedure:
Determine for which control you want an Outlet.
Hold down the Control key on the keyboard, and then drag from the control to an empty space in your code file after the #interface
definition.

Resources