uiview deleted from storyboard is still showing - ios

I have a very strange behavior in my ios app, if I go to the storyboard and delete the UIImageView object and then run the simulator it still show the image.
Any ideas?

I know why you don´t believe me, I didn´t beleive it either when I saw it, but I just found what(not why) was hapening: the problem was that I messed with the main storyboard configured in the project->info, somehow it was calling the old storyboard and i say somehow because there was no file with that name, it was not enough to change the property to the actual storyboard file, I needed to create a new one.

Related

ios - loading decoupled view from nib file

I am having difficulty with something that seems to be trivial. I am following this project https://github.com/eppz/iOS.Blog.UIView_from_Xib and trying to implement the decoupled way of loading a view from a nib file. I was not able to get the desired result in my app (nothing shows up and I get no crashes either) so I did the following:
I took the project from Github https://github.com/eppz/iOS.Blog.UIView_from_Xib
I then proceeded to duplicate the files in the "decoupled" group and name it something trivial like "decoupled2". Basically I am creating a whole new class that stands on its own with its own nib file.
I then changed all of the internal tags and class references. Then I made sure that all of the new references were pointing to this new class.
At this point I added a 6th button to the main VC and made sure to call the right method for my new "decoupled2" class when this 6th button is pressed.
PROBLEM: Everything runs but the view from nib does not show up. Debugging view hierarchy shows nothing. Clicking the 5th button still works, so I didn't break the existing code. Why won't the newly created nib file show up?
This seems rather simple, just duplicate what already works in a project that already works and it will work...or not. What am I missing? Thank you for your help.
I have spent a few days on the problem already. Lots of research but nothing of use so far.
I re-did the task and it worked this time.
Maybe restarting Xcode 8.0 was the key or something else that is under the hood.

Image does not update in Launch Storyboard

I have noticed that if I change an image in the xcassets, the launch storyboard does not update.
For instance, let's say you have a UIImage view in your launch storyboard with an image called "logo" that is blue. If you open up the in the Finder and change the color of the image to red, next time you run on the device the logo will still be blue.
The preview of the storyboard in xCode will show the correct (red) logo image.
Before running, I have tried:
Cleaning the Project
Deleting Derived Data
Deleting the App
Renaming the Image
Nothing seems to fix the problem. Is there another option that I am missing?
Appears to be a problem with caching on the device. Delete your app, restart the device, and pray. Image does not update when changed if that image is used on LaunchScreen.storyboard
Exiting out should normally solve the job... Sometimes, especially in the playground I have heard and experienced, it will not automatically refresh and you can either:
Wait a tiny bit(in most cases) but it seems you would not be asking if it were a few seconds of delay so maybe try
Deleting everything associated with that image(the outlet reference, image on storyboard, and any time you use that image in you code(leave those spaces blank)), then create a new UIImageView and assign it to your desired image.
In your Images.xcassetts file you may have only changed the info on one of the sizes; make sure those are all set.
Then again, especially after the most recent WWDC, there have been some bugs in Xcode that will need to be patched in the future. At the least, I hope this helps you and people who view this in the future.
I tried deleting the app from device while also deleting the derived data and cleaning, but it seems that you have to restart the device. That is the only thing that worked for me.

Xcode crash on opening storyboard

I am developing an app for iOS with Xamarin. Lately, I haven't been able to access my storyboard file in Xcode or compile my app anymore because Xcode crashes right away when opening the .storyboard file.
The error message is the following:
ASSERTION FAILURE <br>
Details: Creating an out of band arbitration unit with a view (<IBUITableViewCell: 0x7fa88d13a5d0>) as the root under another view (<IBUITableView: 0x7fa88cf000e0>) is not yet implemented.<br>The view would need to be in two arbitration units, the one above for positioning constraints, and the root of the one below for sizing constraints. <br>But then that means that subviews cannot have constraints that affect the size of the view, so the view must have ibExternalTranslatesAutoresizingMaskIntoConstraints set to YES.
<br>Object: <IBUITableViewCell: 0x7fa88d13a5d0>
<br>Method: -ibArbitrationUnitWasCreatedWithReceiverAsRootUnderParent:
I tried rebasing my storyboard to the last version that worked (the one the app was submitted to the app store) and weirdly, even that version didn't work.
My plan was to manually remove and every view controller and add them one by one to figure out where the error is.
However I don't understand why XCode crashes when opening the storyboard and not just shows me exactly where the error in my xml is.
So if anyone has encountered this problem before and has a better way to fix it than to manually do it, I would really appreciate any help.
ibExternalTranslatesAutoresizingMaskIntoConstraints needs to be YES
Sounds like the Storyboard was created with an older Xamarin.iOS that introduce this issue.
The fastest solution is to open the storyboard in vi (or Xcode / View As Source, or another text editor of your choice, and replace all translatesAutoresizingMaskIntoConstraints="NO" with "".
Save the file, re-open it in the Storyboard editor and fix your contraints.

Full screen issue after manually creating an empty application in Xcode 6

Since xcode 6 didn't offer an empty application any more, I manually created one by deleting the Launch screen interface file and the Main storyboard file base name in the info.plist file, and deleted Main.storyboard and LaunchScreen.xib then. Considering that I'll drawing the UI by myself, I created a view controller without an xib file. But when I ran the app, there are black bars both on the top and the bottom. I checked the [[UIScreen mainScreen]bounds] and found out that the bounds was 480*320.
I've checked on google and there were suggestions like adding png pictures or creating a xib file, but I really wonder why the property bounds didn't get the right size.
I have met with this problem, it's because you delete your "Launch screen file" and didn't set in general tab "Launch image source".
So you need to make .xcassets file, after right click inside .xcassets file you create "New Launch Image" with name something like "LaunchImage" and set images for appropriate sizes. After that in general tab you set "Launch image source" property name with your "LaunchImage".
Step 1:
Step 2:
Step 3:
A better approach would be to keep the storyboard and everything else Xcode sets up for a single-view app, and then build out your UI programmaticly from the ViewController. That way, you inherit all the automagic stuff the SDK does during startup.
I can't tell you exactly what this automagic stuff is; but, I'm pretty sure your bug would go away if you adopted this approach.

StoryBoard Assistant Editor stopped showing associated file

Xcode storyboard assistant editor stopped showing related files.
"Automatic" is selected and "Class" is filled in Identity Inspector.
It was working before, but know it has stopped.
"Auto" or "CounterPart" modes are still woking for other files except StoryBoard.
A few days ago, I tried to update from Xcode 5 to 6, but later on gave up.
Would that have something to do with it?
With XCode 11 onwards, you can option(alt) + click on the file that you want to view in assistant editor.
Simple Fix.
Found the solution (at least worked for me), it's the same bug that causes you not to be able to create new outlets. You must delete the [DerivedData] folder:
Close the project you are working on with.
Delete the【DerivedData】folder of you project. (This folder may inside your project's folder, or inside
~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere
else that were setup by you.
Restart Xcode.
see here.
In same case this worked for me:
Right click on ViewController file(on left pane) and choose Delete -> Remove Reference.
Right click on folder where this ViewController file was and choose Add files to .. and add this ViewController file which your just deleted.
Profit.
Deleting the Derived Data didn't work for me nor force quitting Xcode and restarting it.
The only thing that worked was deleting both the class and the storyboard (only the reference to them) and adding them back to the project.
Hope to help someone.
If anyone is wondering how to find Assistant editor in XCode 11 then
please find the steps from the below image. You can show this options
in storyboard or Xib files on upper left corner.
Maybe it's too late but just with the keyboard, you can launch a reset for associated files.
Use the keyboard :
command + option + shift + z
You can find it in the menu Xcode->View->Assistant Editor->Reset Editor.
Click first on the assistant window, then click on 'option'+'alt' and right click on the view controller that you want.
I have Xcode 13.1 and none of these solutions is working for me, but this simple solution works for me every single time. With your Storyboard and (empty) Assistant Editor open, in the upper right of the Editor window click the "Add Editor on Right" icon Editor On Right Icon, and just as promised, it will open a new editor to the right of your Storyboard and (broken) Assistant Editor, only the Assistant in THIS window will be working! Just find the "Close Window" x on your broken editor, close it, and in its place will be your shiny new working Assistant!
Full Editor View of where to click to open the new Editor On Right
Tried all the above methods whereas after simply running the app Command + B fixed this issue and I was able to select the screen under automatic.
This command on terminal fixed my issue:
defaults write com.apple.dt.XCode IDEIndexDisable 0
simply exiting and reopening Xcode worked for me.
For Xcode 8+ versions
Check at top process indicator that if Xcode is "indexing" files... if yes, then, please wait until it finishes. Once it get finished. Your file will automatically appear as counterpart in Automatic section.
If Xcode is not showing "indexing" in process bar, then perform as #Anna Chiara's Answer
I deleted ~/Library/Developer/XCode/DerivedData -> didn't work
Xcode->View->Assistant Editor->Reset Editor is disable
Finally, I figured out that the class name of File's Owner of .xib file is incorrect (the class doesn't exist). I corrected it and Assistant Editor works again.
Hope this helps you
I had the same problem. Finally this is what worked for me.
Changing the name of the ViewController File.
Change the name of the class to the new name via the Refactor tool
Refactor tool
The only thing that ended up working for me was copying over the code from the offending ViewController files and completely deleting them, then creating new ones with the exact same name and pasting in the previous code.
The assistant then linked up to the new ViewController files with no issue.
None of these answers worked for me w/ XCode 13. However, the following worked:
Rename the ViewController class to ViewController2
Update the reference in the storyboard to ViewController2
This made the assistant editor appear.
Change the name of the class back to ViewController. Change the reference in main.storyboard back to ViewController and hit enter (Step 2)
I had same issue and spent almost 2 hours of trying different aproaches finally I found something to solve problem.
I've created two or more VC at the same swift file and I think that's why IDE confused about the files.
So I suggest that you should delete your viewcontroller class and clean than reassign class.
I hope it works for you too.
For what it is worth, this was happening to me for the last couple days on 9.3 . I had just added a new build schema for an alternate debug symbol on testflight. It was not until I removed the new schema and then deleted Derived Data and restarted did it start working again. I have re-added the new schema back in and it continues to work. Not sure what the issue was, but that is what solved it for me.
In case anyone is watching I had a bizarre instance of this (Xcode 11): I deleted a View Controller that I'd done incorrectly; dropped in a new one, created the UIView and associated. BUT I didn't bother to create the outlet from the View Controller on the previous screen. Strange that it let me work for a few minutes, then after I had turned off the assistant editor to do something else, turned it back on and only had the UIResponder.h file. Edit - this happened again. Had to delete the 'wire' to the next screen, then recreate - then option to get to the correct .m and .h files reappeared.
I faced a similar issue and here's what I did
I had a swift file and a xib file with its class connected to the swift file like so inside a group folder, and it doesn't show that they're connected.
But when I take them off the folder the assistant works somehow, so I took them off the folder and made an outlet from a UILabel then put them back inside the folder then they're permenantly connected.
Quite Xcode and reopen it. This is solve my problem.
I had the same problem. But my problem was about having the VC's under "View Controller" folder. When I move VC's to main folder instead of "View Controller" folder, I was able to reach the assistant without problem. If you have the same issue like mine, you can solve by deleting all the VC's and create again under your sub folder.
Just add the Class on right side of your story board which you want to open in assistant

Resources