XCode4 lock nib file - xcode

I have a strange issues.
I have a nib file with some view inside and before yesterday all work fine for me.
Today I try to add a view in my nib file but I cannot! When I release a view inside the nib I can see an padlock overlay in the middle of XCode windows..
I changed all View "Lock" propeties in "Nothing" for all the view and the File Owner but didn't work again.
What's wrong!?
Thanks in advance.

I had the same problem and fixed it by selecting the view (or the locked element, a label in my case) and then press the Reset Locking Controls under the Interface Builder Document section in the File Inspector window.
Hope it helps.

The 'Localization Locking' Option ('Reset Locking Control')is here (Xcode 5)
Menu: Editor-> Localization Locking -> Reset Locking Control !
https://stackoverflow.com/a/19666458/1656395

In terminal use following code
sudo chown -R <UserId> <ProjectFolder>/*

Related

How do I correct the fact that my .h file is linking its IBOutlets to a XIB file from another project?

This is a real 'WTF?' moment for me.
I copied some classes out from another project, including copy and pasting the code and some UIBulder components. What did NOT get copied was the XIB file (I went from XIB to storyboard).
My tab / swipe recognizers aren't activating, and when I drill down the only thing I can discover that can explain it is that somehow, someway, I'm hooking up against the XIB file. (When I click on the little button next to the IBAction/IBOutlet lines in the header, it shows me both the storyboard and the xib file as connected).
I'm not referencing that file anywhere that I can find, it's just somehow magically recognized in Xcode. I don't know what to do, how to fix this.
Anyone have any ideas?
Edit: The really annoying bit is that the file doesn't appear to be in my files list when I check there, I can't just delete the reference that way. And since it's referencing the file in the original project, I can't just delete it. (Any changes made in either project cause changes in BOTH projects; their both using the same xib file for some reason). I should be able to simply delete the reference to the xib file, but I can't find the reference.
If you copy the view controller code from one project into another project you will notice a strange thing happening with the outlet. It is referencing the view from the first project without you ever connecting any outlets.
If you left click the little circle and click the reference link you will even be taken to the storyboard view in the other project. Trying to figure out how to get rid of this reference can drive you crazy.
Well, the good news is that there is really nothing for you to fix. You didn't copy over some deep, hard to find referencing link. Xcode is just getting confused because the View Controller and the outlet name are the same in both projects. Basically just ignore what that little circle says. You can close the first project and Xcode will figure things out eventually. Right click your views in the storyboard to see what referencing outlets really exist in the current project. (See my fuller answer for more details.)
No need to delete Derived Data. That doesn't solve the problem anyway. Just try opening both projects at the same time again and you will get the same strange behavior.
The way I figured this out was to separately create two new projects that had view controllers with the same name and a referencing outlet with the same name. I never copied anything but Xcode showed one was referencing the other. Like I said, ignore the little circle.
I just had the same problem. What solved it for me was to close both projects, delete the derived data from both and then reopen the destination project.
I agree, it's a crazy problem.
I'm sure that this problem could happen and I fix it deleting the content of the Derived data folder of XCode.
I just want to add the steps of how to delete those files:
Don't Delete the DerivedData folder.
Go to preferences (Command ,) > Locations Tab
On Derived Data you are going to see the path, clic the right pointing arrow (that will open that location in Finder)
Close XCode
Select all the files inside the DerivedData Folder (do NOT select parent folder) and (Command Delete) or move them to the Trash and then Empty Trash
Open the project and you are done
I hope it helps someone
unless the xib file is in the project. it should not have a link to it.
the xib file connects to the .h file. not the other way around.
You may want to remove the connections in the storyboard and re-connect them.
Also make sure that the storyboard is the UI being started and that the item on the navigation stack is actually the storyboard page. But you should be able to connect both the storyboard and the xib file to the class at the same time. You just cannot connect one IBOutlet to more than one object in a single ui component (e.g. two buttons on the storyboard cannot both be connected to #property IBOutlet UIButton *myCurrentButton you must have a separate IBOutlet for each connection. On the other hand, any number of actions can be connected to an IBAction. which is why you get (id) sender on each action.
I dont know if this is exactly what you are experiencing, but I hope that understanding helps you debug your issue.

Cannot find the windows outlet for the Object in iOS

I have been working with Xcode 4.2.1, but following some tutorials and videos from the earlier version of Xcode.
As usual I had the problem with the Windows Based Application. I created a empty application for my Windows Based Application project and was following some steps from the same forum of how to add a MainWindow.xib file to my project using this post
There is no .xib file when I create a new "Empty Application" in XCode
I also followed one more post which has some good screenshots:
http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
Now my problem is I cannot ctrl+drag of the window outlet from the App Delegate object to the Window object. The reason is I could not find out the window outlet from tze attributes menu. One can see the screenshot of how it is looking in my xcode:
And below one can see how it should have a windows outlet for the App Delegate.
Is there anything I am missing or left something behind before coming there. I followed the steps exactly as mentioned in the above posts. I tried creating new projects just to make sure Im doing everything correct.
Any information regarding this would be appreciated.
Thanks
Raaks
From your tutorial..
http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
The answer to your problem is Simple(and also this is the way you should do most of the time in future..)
1) Click on File's Owner(In the placeholder section..left to the xib).
2) In the attributes section you will see a window Outlet..
3) Drag window from the attributes section(right click-drag or ctrl-drag.) and drop it on window in Objects window..(left to the xib)

Xcode 4 Interface Builder: How to set File's Owner

I have myController.h and myController.m defined, and proceeded to create a myController.xib with the Wizard. I can't, however, connect the controls from the xib file to the class interface. Usually when I drop the connection cross hair on the File's Owner icon, it'll show me a list of properties that have been declared as IBOutlet, but this time it's just nothing.
I thought the names of the class files and XIB file (myController) automatically binds File's Owner, but apparently that is not the case.
How can I manually bind the two?
Go to the Identity Inspector (Cmd+Option+3) and change the class to myController.
Here it is in 5.1:
I thought I would add this screenshot as it took me some time to find it!
Had the same question... XCode 4.2 enables to create a subclass of UIViewController and there you can optionally check the "with XIB for user interface" option.
New File... >> UIViewControler subclass >> "with xib..."
I found a way to do it manually... When the world is not using XIB(s) anymore...
Open the XIB or NIB file in your favourite text editor
you will find this line there...
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MyClassName">
Change the MyClassName to the class you want to refer it to, save the file and your file's owner will be changed.
Caution: Close Xcode (To auto reload the changes) and also take a backup in case you mess up something.
I've experienced the same issue while in Xcode 4: while trying to make a connection to file's owner, the icon did not respond while dragging the connection line and hovering over file's owner. Resetting the custom class didn't work. I ended up trying quitting and restarting Xcode and only this did the trick.
If you are looking an answer for the same problema in Xcode 12.1, just set the class for the view, and restart Xcode, it will do the trick.

How to fix a project that Interface-Builder fubar'd

Help me un-fubar interface-builder in XCode4.
I created a button in interface-builder and defined an IBAction method for it in the view's code. It ran fine. Then I renamed the button's action method using XCode's refactor / rename tool. It ran fine.
Then I deleted the button in interface-builder by selecting the button and hitting the delete key. When I rebuilt the project the button is still there in the simulator. Back in interface-builder, the button is gone. There is no reference to the button in the code, but the button's IBAction method is still there.
To make matters worse, the button's original action method is getting called which of course throws a runtime exception of selector not found. When I do a project search for name of the original action method nothing is found, but the runtime is still trying to call it. I did a "clean" and rebuild but no joy.
If I try to open the .xib file as ASCII Property list, it tells me the data has been corrupted. (I figured that out.)
Other than deleting the .xib file and creating a new view, is there any way to fix this?
And what does "clean" do if it doesn't delete the binaries?
Thanks for your help!
Try iOS Simulator -> Reset Content and Settings. (To save time, Xcode tries to copy resources before launch only if those resources have changed, but if things have gone screwy…)
Clean did not work for me. In my experience, Xcode keeps a cache of the "compiled .xib" without regard to timestamps (try switching out a xib for one with the same name). My fix was to modify each view that needed to be refreshed. Very frustrating, but it works.
Try going in Xcode to Build > Clean All targets, it should fix it

Why is IB changing the object IDs when opening a xib file?

I have the same problem with some xib files in different projects on different macs. IB is changing the Object IDs of some views in my xib file. I need only to double click the xib file from Xcode to open it in IB and then try to close the xib file again without changing anything and IB marks the xib file as dirty so that I have to save it again.
This drives me crazy because it will break all my localizations since they are depending on the object IDs (ibtool).
Any ideas or experiences?
Thanks
This was a bug in old versions of IB. They fixed it in, IIRC, 3.1.

Resources