I can't uncheck "Refuses First Responder" in interface builder - macos

I can't uncheck the properties under "State" in the Control section for the NSTableView:
When I click on a checkbox, the sign disappears for 1 second and then it comes back.
Could you explain me why?

The solution is that I had no Columns in the table: Column = 0.
(I'm adding the columns programmatically).
Still this is a bug in Interface Builder user interface.

Able to uncheck with XCode 6 on 10.10.
From your image attached, your line break mode is shown as invalid value. This could have happened when you tried to edit the source xml of xib.
Did you try selecting a valid Line break mode. Also what version of XCode are you using.

Related

Capturing A CheckBox Toggle State In An Xcode AppleScript Project

I have been trying to figure this out for a few days now and still cannot understand how this works.
I have created a new AppleScript Project in Xcode version 13.4.1 and added a CheckBox and a Button. My goal is to try and so something depending on whether the CheckBox is Ticked or Un-Ticked.
I am extremely new to Xcode so I am most likely doing something wrong.
The reason for not showing real code is that I have nothing that works so I am asking if anyone can help me learn this by filling in the missing gaps.
The documentation for Xcode Applescript object seems thin on the ground to me or at least that's what I am finding.
Thank you
property checkBox : 1 -- bound to the value of the check box & is ticked when run
#START BUTTON
on startButtonClick_(sender)
-- if checkbox is ticked then show alert "ticked"
-- if checkbox is NOT ticked then show alert "NOT ticked"
end startButtonClick_
Update
It was suggested that including real code would be more useful which I do agree with so here is the latest attempt I have tried.
property checkBox : missing value -- bound to the value of the check box
#START BUTTON
on startButtonClick_(sender)
set checkBox to (checkBox as boolean) -- toggle
if checkBox is 1 then display alert "Ticked"
log checkBox
end startButtonClick_
The alert never shows but yet the log output shows 1 when the checkbox is ticked and 0 when its unticked when I press the button
There are two issues here, depending on exactly what you're trying to do.
If you are trying to connect the checkbox action so that it calls a handler when you click on the checkbox, follow this procedure:
Make a handler in your script (in your case, the startButtonClick_(sender) handler)
Open the xib file, select the First Responder object on the left
Go to the Attributes pane in the Inspectors area. You'll see a
box labeled 'User Defined', so click the '+' button to add a new
user defined action.
Use the name of your handler with a colon, not an underscore, e.g.: startButtonClick:
Set the 'type' to NSButton (or I suppose you can use the default 'id')
Select the File's Owner object in IB, go to the Connections Inspector, and make sure the AppDlegate is connected as the File Owners delegate.
It should be, but I tripped over that problem during testing, so...
Select the button-in-question in IB
Go to the Connections Inspector, and control-drag from the Sent Actions area to the First Responder, selecting your user-defined action (which should now appear in the popup menu).
Now when you run the app and click the checkbox, it will run the hander with a reference to the checkbox as its argument. You can query that using sender's state() to get the current value of the button.
If you want a static, global reference to the button so you can check its state anywhere in the script, you may run into a problem. In Xcode 12 and earlier script properties would appear as outlets in the AppDelegate popup menu, so that you could connect GUI elements graphically. Xcode 13 has an as yet unresolved bug that makes this impossible, but you can work around it to an extent by editing the xib xml directly. Ive detailed how to do that in this post.
Hope this helps.

manual option is not showing in Xcode 11 assistant editor and how to add IBOutlet?

I recently updated to Xcode 11 and some of its user interface changed. in older version of Xcode there was options of accessing files in assistant editor using automatic or manual. but in this version of Xcode I can't see any manual option in assistant editor. so I am not able to add IBOutlet and IBAction methods to particular storyboard.
so can anyone tell me how to add these actions and outlets, that would be great help. thanks
By pressing the above button, Xcode will split the view and allow you to select a custom file using the file tree at the top.
You are correct.
The Manual option is no longer visible. You can still achieve the same result by doing a quick open using Cmd+Shift+O then type the name of any file you want to open. Press the Alt key and the file will open in the Assistant Editor Window.
As others have noted the new add editor button allows you to add new editors and open files into them. You could file a bug report but you may want to consider that you're likely to get a "works as designed" type of reply.
You can always change or add new keyboard shortcuts to get the behavior you want by viewing the preferences key bindings area and search for the command you want to shortcut.
Note
You can still ctrl+drag from storyboard to the class by the Adjust
Editor button in the upper right of the storyboard. Then just select
Assistant Editor on the list. After which you can make IBOutlets/IBActions.
open your storyboard, hold option key and select the file you want
In the documentation outline of storyboard, try to choose the "correct" item, which you want to set up outlet connections. Say you want to set up an outlet connection for cell of table/collection view.
View Controller > Collection View > Cell > Content View > Image View.
Try to select Cell, "Content View" or "Image View", then check the jump bar of assistant editor, you're probably able to switch to the .swift file you want.
Reference

Find and Replace within a Selection in Xcode 9

I use find and replace in selection all the time. It is crucial to my workflow. It seems to be gone from Xcode 9. This was achieved by holding down the option key once the desired text was selected. The option key would change the context of the replace button to replace in selection. This no longer seems to be available.
Is the ability to find and replace within a selection truly gone from Xcode 9? If not, how do I use it?
Edit: for what it's worth I posted a bug report here.
Edit 2: Here is a timed screen grab with me holding down the option key.
Edit 3: My Xcode version is 9.1 (9B55), someone below with 9.2 doesn't have this problem, maybe it's been fixed in the 9.2 beta.
Apple is aware of this issue. It is fixed in the latest Xcode 9.2 beta. Hold down the Option key; at the right of the replace field, the All button is replaced by All In Selection.
Screen shot of the About dialog, showing the working version:

Xcode 6 - Main.storyboard only showing up as source code, Interface Builder missing

Somehow my Xcode settings got messed up as it would only show my Main.storyboard file as XML code. I've been told this can be fixed by selecting the Interface Builder from the "Open As" menu, but there is nothing under the menu (the only "selection" is a greyed-out "<None>"). I've cleared my Xcode caches, but this does not help. Other than that, my project still compiles properly.
How can this be resolved?
As so many people have pointed out, right-click on the file and hover over Open As and select Default - Interface Builder.
However, if this is not an option for you because Open As shows <None>, make sure you are in the standard editor and not the version editor. Go up to View in Xcode menu --> view --> hover over Standard Editor and select Show Standard Editor. Now repeat the steps others have suggested and you should get the results you're looking for.
Hide Code Review helped here (Xcode 12.2).
You might be in code review mode and Xcode thinks you want to compare the XMLs
change to Standard Editor by clicking 'Command + Enter' key . Then Main.storyboard may show as Interface Builder.
I had the same issue, where "Open As" wasn't an option on the main storyboard, and xibs were also showing as XML.
The solution that worked for me was to right click on an xib which did have the "Open as --> Interface Builder" option. Then, I went back to storyboard, and the main storyboard showed up properly.
Tap on the Arrows icon that are left and right, see image below:
If you go over to the project outline and control click on the storyboard file and hold down the cursor, you will see the option to open as, this will let you open the storyboard as a certain type. Click on that and choose open as story board. Good luck!
EDIT#1
Sorry, I think I misread your post. I thought you were doing those steps from the menu bar. Not the outline. I am assuming you have restarted Xcode and your computer.
I had this issue with Xcode 8, no luck with Open As > menu... and the solution was as follow:
Make sure the Type is Default - Interface Builder in the Identity and Type right panel (see screenshot). In my case it was "Swift source code" selected :
Now, in the left pane, right-click on your storyboard, and magically then the option Open As > Interface Builder - Storyboard appeared !
I had "Main.storyboard.xml" in Xcode 9 folder but can not see "Default - Interface Builder" in the list of extensions proposed in "Identity and type".
I simply deleted the .xml extension in the name of "Identity and type" and then I can see again "Default - Interface Builder" in Open as.
This is just a quick fix/ long shot, and depending on the specifics of your situation it might not be helpful at all, but you can import and open storyboard files in other projects.
So, try importing your storyboard file in a new project and see if it displayed correctly there.
Has helped me in the past with misbehaving nib files.
Took some doing but I found how to fix this every time... When you click on the storyboard and it is showing as source, click on the icon that shows the utilities view on the righthand side.. Look for the identity type.. Type should be Default - Interface Builder.. Mine got switch to C Source Code.. Not sure how.. but...
I was stuck at (Hide Code Review helped here . You might be in code review mode and Xcode thinks you want to compare the XMLs)
left and right arrow icons is code review Mode

Xcode Line Wrapping setting doesn't work

I'm trying to disable line wrap in Xcode 4.3.2 (4E2002), but the setting doesn't seem to work. I seriously HATE line wrapping and it makes me super-unproductive. I've always had it turned off before, but since the latest XCode-update, it is enabled regardless of setting.
Is this an Xcode bug?
This is my settings dialog:
This comes by some files you have set Wrap line in Show the File inspector.
Please choose a file. View -> Utilities -> Show File inspector then deselect Wrap lines in Text Settings section.
I had >ONE< file out of two dozen that was wrapping it's text in the XCode editor. Although I don't know how/why the file got into this state, I figured out what it was and how to fix it.
If you show the XCode right-hand Utilities pane, and select the Document icon at the top left, you'll see a variety of settings relevant to that one file, including it's name, type, and location. Below that are some "Text Settings" values, including a checkbox for "Wrap lines". If that box is checked, it overrides the XCode preference and wraps the lines.
This picture shows the XCode editor areas, in case you are confused: XCode Editor Areas

Resources